Beispiel #1
0
        protected void bAddEnterprise_Click(object sender, EventArgs e)
        {
            try
            {
                CY.GFive.Core.Business.Enterprise ne = new CY.GFive.Core.Business.Enterprise();
                ne.Name = txtName.Text.Trim();
                if (!string.IsNullOrEmpty(txtEntCode.Text.Trim()))
                {
                    ne.EntCode = txtEntCode.Text.Trim();
                    txtEntCode.Text = "";
                }
                if (!string.IsNullOrEmpty(txtEntCaptial.Text.Trim()))
                {
                    ne.EntCaptial = Convert.ToDecimal(txtEntCaptial.Text.Trim());
                    txtEntCaptial.Text = "";
                }
                if (!string.IsNullOrEmpty(txtPhone.Text.Trim()))
                {
                    ne.Phone = txtPhone.Text.Trim();
                    txtPhone.Text = "";
                }
                if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
                {
                    ne.Email = txtEmail.Text.Trim();
                    txtEmail.Text = "";
                }
                if (!string.IsNullOrEmpty(txtAddress.Text))
                {
                    ne.Address = txtAddress.Text;
                    txtAddress.Text = "";
                }
                if (!string.IsNullOrEmpty(txtInCharge.Text))
                {
                    ne.InCharge = txtInCharge.Text;
                    txtInCharge.Text = "";
                }
                ne.AddDate = DateTime.Now;
                ne.AddPersonCode = ddlAddPersonCode.SelectedValue.ToString();
                ne.EntCate = ddlEntCate.SelectedValue.ToString();
                ne.DepartmentCode = ddlDepartmentCode.SelectedValue.ToString();
                ne.MajorTypesWork = txtMajorTypesWork.Text.Trim();
                ne.Positions = txtPositions.Text.Trim();
                ne.WebSite = txtWebSite.Text.Trim();
                ne.Save();
                txtName.Text = "";
                ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('添加成功!');window.location.href='./EnterpriseList.aspx';</script>");

            }
            catch (Exception ex)
            {
                ErrorMsg.Text = "错误:" + ex.Message;
            }
        }
Beispiel #2
0
 protected void bAddEnterprise_Click(object sender, EventArgs e)
 {
     try
     {
         CY.GFive.Core.Business.Enterprise ne = new CY.GFive.Core.Business.Enterprise();
         ne.Name = txtName.Text.Trim();
         if (!string.IsNullOrEmpty(txtEntCode.Text.Trim()))
         {
             ne.EntCode = txtEntCode.Text.Trim();
             txtEntCode.Text = "";
         }
         if (!string.IsNullOrEmpty(txtEntCaptial.Text.Trim()))
         {
             ne.EntCaptial = Convert.ToDecimal(txtEntCaptial.Text.Trim());
             txtEntCaptial.Text = "";
         }
         if (!string.IsNullOrEmpty(txtPhone.Text.Trim()))
         {
             ne.Phone = txtPhone.Text.Trim();
             txtPhone.Text = "";
         }
         if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
         {
             ne.Email = txtEmail.Text.Trim();
             txtEmail.Text = "";
         }
         if (!string.IsNullOrEmpty(txtAddress.Text))
         {
             ne.Address = txtAddress.Text;
             txtAddress.Text = "";
         }
         if (!string.IsNullOrEmpty(txtInCharge.Text))
         {
             ne.InCharge = txtInCharge.Text;
             txtInCharge.Text = "";
         }
         ne.AddDate = DateTime.Now;
         ne.AddPersonCode = ddlAddPersonCode.SelectedValue.ToString();
         ne.EntCate = ddlEntCate.SelectedValue.ToString();
         ne.DepartmentCode = ddlDepartmentCode.SelectedValue.ToString();
         ne.Save();
         txtName.Text = "";
         ErrorMsg.Text = "添加成功";
     }
     catch (Exception ex)
     {
         ErrorMsg.Text = "错误:" + ex.Message;
     }
 }
Beispiel #3
0
        protected void bDelete_Click(object sender, EventArgs e)
        {
            CheckBox cb;
            CY.GFive.Core.Business.Enterprise ent=new CY.GFive.Core.Business.Enterprise();
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                cb = (CheckBox)GridView1.Rows[i].FindControl("chkSelect");
                if (cb.Checked)
                {
                    int iID = int.Parse(GridView1.DataKeys[i].Value.ToString());
                    ent = CY.GFive.Core.Business.Enterprise.Load(iID);
                    IList<CY.GFive.Core.Business.GraduationInfo> gi = CY.GFive.Core.Business.GraduationInfo.GetGraduationInfoListByQuery(" [EntName]='"+ent.Name+"'");
                    if (gi.Count != 0)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "Error", ent.Name + "与其他数据相关,无法删除!");
                        continue;
                    }
                    if (ent != null)
                    {
                        ent.DeleteOnSave();
                        ent.Save();
                    }
                }

            }
            BindGridview("");
        }