Exemplo n.º 1
0
        //删除
        protected void btnDelete_Clik(object sender, CommandEventArgs e)
        {

            string fid = e.CommandName;
            CommonDao<SafeRewards> newmgr = new CommonDao<SafeRewards>();
            CommonDao<SafeDeptMoney> moneymgr=new CommonDao<SafeDeptMoney>();

            SafeRewards sf = newmgr.FindById(fid);

            CommonDao<SafeRewards> rewardmgr = new CommonDao<SafeRewards>();
            SafeDeptMoney sm = moneymgr.FindByConditions(" deptname='" + sf.dept + "' and deptyear=datepart(yy,'"+sf.createtime.ToString()+"') ");
            sm.currentmoney = sm.currentmoney - sf.rewards;
            if (sm != null && sf != null)
            {

                if (moneymgr.Update(sm))
                {
                    if (newmgr.Del(sf))
                    {
                        MsgShow("恭喜您,删除记录成功!");
                        InfoBind();
                    }
                }
                else
                {
                    MsgShow("Sorry,删除记录失败!");

                }
            }
            else {
                MsgShow("Sorry,未找到对应部门金额,删除记录失败!");
            }
        }
Exemplo n.º 2
0
        //删除
        protected void btnDelete_Clik(object sender, CommandEventArgs e)
        {

            string fid = e.CommandName;
            CommonDao<SafeBook> newmgr = new CommonDao<SafeBook>();
            SafeBook sf = newmgr.FindById(fid);

            if (newmgr.Del(sf))
            {
                MsgShow("恭喜您,删除记录成功!");
                InfoBind();
            }
            else
            {
                MsgShow("Sorry,删除记录失败!");

            }
        }
Exemplo n.º 3
0
        protected void GridViewEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString();


            CommonDao<Safezhuan> newmgr = new CommonDao<Safezhuan>();
            Safezhuan safezhuan = newmgr.FindById(fid);

            CommonDao<SafeNews> safenewmgr = new CommonDao<SafeNews>();

            int count = int.Parse(safenewmgr.GetTotalCount("NewsZhuan='" + fid + "'"));
            if (count == 0)
            {

                if (safezhuan != null)
                {

                    if (newmgr.Del(safezhuan))
                    {
                        Alert("热点专题删除成功!");
                        BindGridView();
                    }
                }
            }
            else {

                Alert("有属于该专题的文章,专题不能删除!");
            
            }
        }
Exemplo n.º 4
0
        protected void GridViewEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string fid = GridViewEmployee.DataKeys[e.RowIndex].Value.ToString();
            CommonDao<SafeDeptMoney> newmgr = new CommonDao<SafeDeptMoney>();
            SafeDeptMoney safemoney = newmgr.FindById(fid);
            CommonDao<SafeRewards> rewardmgr = new CommonDao<SafeRewards>();
            int countreward = int.Parse(rewardmgr.GetTotalCount("dept='" + safemoney.deptname + "' and datepart(yy,createtime)='" + safemoney.deptyear + "'"));
            if (countreward == 0)
            {
                if (safemoney != null)
                {
                    if (newmgr.Del(safemoney))
                    {
                        Alert("部门金额删除成功!");
                        BindGridView();
                    }
                }
            }
            else {
                Alert("已有部门奖惩记录,无法删除!");
            }

        }