예제 #1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                string cn = txtCompName.Text.ToString().Trim();
                string ca = txtCompAddr.Text.ToString().Trim();
                string ct = txtCompTag.Text.ToString().Trim();

                #region dataset
                DataSet dataSet = new DataSet();
                DataRow compRow = null;

                DataColumn colCompName = new DataColumn("custCompName", System.Type.GetType("System.String"));
                DataColumn colCompAddr = new DataColumn("custCompAddress", System.Type.GetType("System.String"));
                DataColumn colCompTag  = new DataColumn("custCompTag", System.Type.GetType("System.String"));

                DataTable compTable = new DataTable("tbl_customer_company");

                compTable.Columns.Add(colCompName);
                compTable.Columns.Add(colCompAddr);
                compTable.Columns.Add(colCompTag);

                compRow = compTable.NewRow();
                compRow["custCompName"]    = cn;
                compRow["custCompAddress"] = ca;
                compRow["custCompTag"]     = ct;
                compTable.Rows.Add(compRow);

                dataSet.Tables.Add(compTable);
                #endregion

                DataSet         dsCheck = new DataSet();
                custCompProcess ccp     = new custCompProcess(dsCheck);

                ccp.RealCompView();
                int rowRtn = -1;

                ccp.DoCheckCompName(cn);
                rowRtn = ccp.IntRtn;
                if (0 == rowRtn)
                {
                    ccp.DoCheckCompTag(ct);
                    rowRtn = ccp.IntRtn;

                    if (0 == rowRtn)
                    {
                        ccp.MyDst = dataSet;

                        ccp.Add();

                        string newCompId = ccp.StrRtn;

                        Response.Redirect("~/Main/custInfoManager/custCompManager/custCompEdit.aspx");
                    }
                    else
                    {
                        lblCompTag.Text = "公司简称已存在!";
                    }
                }
                else
                {
                    lblCompName.Text = "公司名已存在!";
                }
            }
        }