Beispiel #1
0
        public void DeleteCom()
        {
            ErrInfo err = CanDelete(dr["com_id"].ToString());

            if (err.IsSuccess == false)
            {
                MessageBoxEx.Show(err.Info, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBoxEx.ShowQuestion("是否确认删除?"))
            {
                Dictionary <string, string> dicFileds = new Dictionary <string, string>();
                dicFileds.Add("enable_flag", DataSources.EnumEnableFlag.DELETED.ToString("d"));
                dicFileds.Add("update_by", GlobalStaticObj.UserID);
                dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime).ToString());
                List <string> listField = new List <string>();
                listField.Add(dr["com_id"].ToString());
                bool flag = DBHelper.BatchUpdateDataByIn("批量删除公司档案", "tb_company", dicFileds, "com_id", listField.ToArray());
                if (flag)
                {
                    MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageProcessor.UpdateComOrgInfo();
                    deleteMenuByTag(this.Tag.ToString(), uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Beispiel #2
0
        public ErrInfo CanDelete(string ComID)
        {
            ErrInfo err = new ErrInfo(true, "成功");

            if (HasOrg(ComID))
            {
                err = new ErrInfo(false, "要删除的公司下还有组织,无法删除");
            }
            if (HasWarehouse(ComID))
            {
                err = new ErrInfo(false, "要删除的公司下还有仓库,无法删除");
            }
            return(err);
        }
Beispiel #3
0
        //删除操作
        void UC_DeleteEvent(object sender, EventArgs e)
        {
            List <string> listField = this.dgvRecord.GetCheckedIds(this.columnCheck, this.columnId.Name);

            if (listField.Count == 0)
            {
                MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            for (int i = 0; i < listField.Count; i++)
            {
                ErrInfo err = CanDelete(listField[i]);
                if (err.IsSuccess == false)
                {
                    MessageBoxEx.Show(err.Info, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            if (MessageBoxEx.ShowQuestion("是否确认删除?"))
            {
                Dictionary <string, string> dicFileds = new Dictionary <string, string>();
                dicFileds.Add("enable_flag", DataSources.EnumEnableFlag.DELETED.ToString("d"));
                dicFileds.Add("update_by", GlobalStaticObj.UserID);
                dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime).ToString());

                bool flag = DBHelper.BatchUpdateDataByIn("批量删除公司档案", "tb_company", dicFileds, "com_id", listField.ToArray());
                if (flag)
                {
                    MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //dicFileds = new Dictionary<string, string>();
                    //dicFileds.Add("enable_flag", DataSources.EnumEnableFlag.DELETED.ToString("d"));
                    //dicFileds.Add("update_by", GlobalStaticObj.UserID);
                    //dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime).ToString());
                    //DBHelper.BatchUpdateDataByIn("删除公司下属组织", "tb_organization", dicFileds, "com_id", listField.ToArray());
                    if (dgvRecord.Rows.Count > 0)
                    {
                        dgvRecord.CurrentCell = dgvRecord.Rows[0].Cells[0];
                    }
                    this.BindPageData();
                    MessageProcessor.UpdateComOrgInfo();
                }
                else
                {
                    MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
 public ErrInfo CanDelete(string ComID)
 {
     ErrInfo err = new ErrInfo(true, "成功");
     if (HasOrg(ComID))
     {
         err = new ErrInfo(false, "要删除的公司下还有组织,无法删除");
     }
     if (HasWarehouse(ComID))
     {
         err = new ErrInfo(false, "要删除的公司下还有仓库,无法删除");
     }
     return err;
 }