Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtDepartName.Text.Trim().Length == 0)
            {
                strErr += "单位名称不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            Cultural.Model.Department depart = new Cultural.Model.Department();
            depart.DepartName = txtDepartName.Text.Trim();
            depart.MainCharge = txtChargeName.Text.Trim();
            depart.Address    = txtAddress.Text.Trim();
            depart.Phone      = txtConnect.Text.Trim();
            depart.BoardID    = int.Parse(ddlDepartType.SelectedItem.Value);

            string RegTime = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0'));

            depart.Status  = "1";
            depart.PicURL  = hidFilePath.Value;
            depart.Describ = txtResume.Text.Trim();
            if (id != null && id.ToString() != "")
            {
                depart.Weight   = ddlShow.SelectedIndex == 0 ? 0 : departBll.GetModel(int.Parse(id)).Weight;
                depart.DepartID = int.Parse(id);
                departBll.Update(depart);
            }
            else
            {
                depart.Weight = ddlShow.SelectedIndex;
                departBll.Add(depart);
            }

            int tempid = departBll.GetMaxId() - 1;

            if (tempid != 0)
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "ShowDepartSingle.aspx?id=" + tempid.ToString());
            }
        }
Exemplo n.º 2
0
 protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "MemDelete")
     {
         Cultural.Model.Department depart = new Cultural.Model.Department();
         depart        = bll.GetModel(int.Parse(e.CommandArgument.ToString()));
         depart.Status = "0";
         bll.Update(depart);
         BindData();
     }
     if (e.CommandName == "DepartTop")
     {
         Cultural.Model.Department depart = new Cultural.Model.Department();
         depart        = bll.GetModel(int.Parse(e.CommandArgument.ToString()));
         depart.Weight = depart.Weight == 9?8:9;
         bll.Update(depart);
         BindData();
     }
 }