⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qckmye_add.aspx.cs

📁 ASP.NET的一些开发实例,有论坛管理系统等
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Com.Ascs.Plp.CW;
using System.Data.SqlClient;
using com.unicafe.ui;
using com.unicafe.common;
using com.unicafe.security;
using com.ascs.plp.common;
using com.ascs.plp.publics;

namespace PLP.CWZZ.QCKMYE
{
	/// <summary>
	/// QCKMYE_ADD 的摘要说明。
	/// </summary>
	public class QCKMYE_ADD :com.unicafe.ui.UnicafePage
	{

		SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
		Com.Ascs.Plp.CW.CW_KMYE CW_KMYE = new Com.Ascs.Plp.CW.CW_KMYE();
		protected System.Web.UI.WebControls.Label lb_KJND;
		protected System.Web.UI.WebControls.Label lb_KJQJBH;
		Com.Ascs.Plp.CW.CW_KJQJMgr CW_KJQJMgr = new Com.Ascs.Plp.CW.CW_KJQJMgr();
		protected System.Web.UI.WebControls.Label lb_JGDM;
		protected System.Web.UI.WebControls.LinkButton datacheck;
		protected System.Web.UI.WebControls.TextBox KJKM;
		protected System.Web.UI.WebControls.TextBox kmye;
		protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
		Com.Ascs.Plp.CW.CW_KMYEMgr  CW_KMYEMgr = new Com.Ascs.Plp.CW.CW_KMYEMgr();
		
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			try
			{
//				this.VerifyPage();
//				this.VerifyPage("zt_qcye_mgr");
			
				// 在此处放置用户代码以初始化页面
				if (!this.IsPostBack)  //判断第一次显示
				{
					ViewState["JGDM"]=this.CurrentJGXX.JGDM;
					ViewState["KJND"]=this.Request.QueryString["KJND"];
					this.lb_JGDM.Text=ViewState["JGDM"].ToString();
					this.lb_KJND.Text=ViewState["KJND"].ToString();
					ViewState["KJQJ"]=this.CW_KJQJMgr.GetQYKJQJ(ViewState["JGDM"].ToString(),ViewState["KJND"].ToString())[0];
					this.lb_KJQJBH.Text=ViewState["KJQJ"].ToString();
				}
			}
			catch(Exception e1)
			{
				LogService.Write ("新增期初余额时产生异常。");
				LogService.Write (e1.Message);
				Prompt.PromptError(this,"新增期初余额时产生异常。");
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.datacheck.Click += new System.EventHandler(this.datacheck_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void datacheck_Click(object sender, System.EventArgs e)
		{
			try
			{
				//需要增加数据检测
				CW_KMYE.JGDM = this.lb_JGDM.Text; 
				CW_KMYE.KJND = this.lb_KJND.Text;
				CW_KMYE.KJQJ = this.lb_KJQJBH.Text;
				CW_KMYE.KJKM = this.KJKM.Text.Trim();
				CW_KMYE.QCYE = Convert.ToDecimal(this.kmye.Text.Trim());
				this.CW_KMYE.JFFSE=0;
				this.CW_KMYE.DFFSE=0;

				//新增会计科目
				this.cn.Open();//启动连接
				SqlCommand mySqlCommand=new SqlCommand();
				mySqlCommand.Connection=cn;
				SqlTransaction myTrans = this.cn.BeginTransaction();//建立事务
				mySqlCommand.Transaction = myTrans;//绑定事务
				
				if (CW_KMYEMgr.HandleKMYE(mySqlCommand,CW_KMYE))
				{
					myTrans.Commit();
					//获取父页面的当前页索引
					string PageIndex = this.Request.QueryString["PageIndex"];
					//获取父页面的URL
					string ReturnURL=string.Format("QCKMYE_View.aspx?KJND={0}&PageIndex={1}",this.lb_KJND.Text, PageIndex);
					Response.Write("<script language=javascript>window.opener.location='" + ReturnURL + "';window.close();</script>"); 
					 
				}
				else	
				{
					myTrans.Rollback();
					//使用时将下面代码中的"MainModel_1.aspx"改到特定页面的打开页面的URL
					Response.Write("<script language=javascript>window.opener.location='../../Publics/Error.aspx?errmsg=该科目起初余额未能增加成功。';window.close();</script>");  
							
				}
				cn.Close();
			}
			catch(Exception e1)
			{
				LogService.Write ("添加期初余额时产生异常。");
				LogService.Write (e1.Message);
				Prompt.PromptError(this,"添加期初余额时产生异常。");
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -