Esempio n. 1
0
 //修改记录函数
 public bool Modify(Model.Contact model, out string msg)
 {
     if (!CheckModify(model, out msg))
     {
         return(false);
     }
     else
     {
         return(dal.Modify(model));
     }
 }
Esempio n. 2
0
 //添加记录函数
 public bool Update(Model.Contact model, out string msg)
 {
     if (!CheckModel(model, out msg))
     {
         return(false);
     }
     else
     {
         return(dal.Update(model));
     }
 }
Esempio n. 3
0
        public bool CheckModel(Model.Contact model, out string msg)
        {
            bool check = true;

            msg = "";

            if (model.Name == "")
            {
                msg   = "联系人姓名不能为空!";
                check = false;
                return(check);
            }
            if (!Utility.CheckMobilePhone(model.Phone)) // 需要添加引用和using 命名空间
            {
                msg   = "手机号码不正确!";
                check = false;
                return(check);
            }
            if (!Utility.CheckEmail(model.Email))
            {
                msg   = "Email 格式不正确!";
                check = false;
                return(check);
            }
            if (!Utility.CheckQQ(model.QQ))
            {
                msg   = "QQ 号码不正确!";
                check = false;
                return(check);
            }
            if (!Utility.CheckPhone(model.OfficePhone))
            {
                msg   = "办公电话不正确!";
                check = false;
                return(check);
            }
            if (!Utility.CheckPhone(model.HomePhone))
            {
                msg   = "家庭电话不正确!";
                check = false;
                return(check);
            }
            return(check);
        }
Esempio n. 4
0
        public bool CheckModify(Model.Contact model, out string msg)
        {
            bool check = true;

            msg = "需要修改的记录不存在";

            if (model.Table == "department")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_departments) || Utility.Check(model.Old_start_time) || Utility.Check(model.Departments) || Utility.Check(model.scrap_date) || Utility.Check(model.End_time) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.End_time))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "rent")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_tenant) || Utility.Check(model.Old_start_time) || Utility.Check(model.Tenant) || Utility.Check(model.scrap_date) || Utility.Check(model.End_time) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.End_time))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "repair")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_money) || Utility.Check(model.Old_start_time) || Utility.Check(model.Money) || Utility.Check(model.scrap_date) || Utility.Check(model.End_time) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason) || Utility.Check(model.Repair_reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.End_time))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Old_money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }

            if (model.Table == "scrap")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_name) || Utility.Check(model.Buy_price) || Utility.Check(model.Buy_date) || Utility.Check(model.Scrap_date) || Utility.Check(model.Name) || Utility.Check(model.Old_date) || Utility.Check(model.Old_start_time) || Utility.Check(model.Money) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Buy_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }

                if (!Utility.CheckTime(model.Scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Buy_price))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Old_money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "acuumulated_depreciation")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_money) || Utility.Check(model.Old_date) || Utility.Check(model.Now) || Utility.Check(model.Date) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Old_money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Now))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }

            if (model.Table == "value_decrease")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Old_money) || Utility.Check(model.Old_date) || Utility.Check(model.Sum) || Utility.Check(model.Date) || Utility.Check(model.Recorder) || Utility.Check(model.Inspecter) || Utility.Check(model.Reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Old_money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Sum))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            return(check);
        }
Esempio n. 5
0
        //判断信息是否符合规范
        public bool CheckModel(Model.Contact model, out string msg)
        {
            bool check = true;

            msg = "资产编号不存在";
            if (model.Table == "summary")
            {
                msg = "资产编号已存在";
                if (Utility.Check(model.Price) || Utility.Check(model.Name) || Utility.Check(model.Id))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Buy_time))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Discard_time))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Price))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "department")
            {
                if (Utility.Check(model.Id) || Utility.Check(model.Departments))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "repair")
            {
                if (Utility.Check(model.Money) || Utility.Check(model.Id) || Utility.Check(model.Repair_reason))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Money))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "accumulated_depreciation")
            {
                if (Utility.Check(model.Sum) || Utility.Check(model.Id))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Now))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "value_decrease")
            {
                if (Utility.Check(model.Buy_price) || Utility.Check(model.Id))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Sum))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "scrap")
            {
                if (Utility.Check(model.Name) || Utility.Check(model.Id) || Utility.Check(model.Buy_price))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Buy_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.Scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckMoney(model.Buy_price))
                {
                    msg   = "金额格式不正确";
                    check = false;
                    return(check);
                }
            }
            if (model.Table == "rent")
            {
                if (Utility.Check(model.Tenant) || Utility.Check(model.Id))
                {
                    msg   = "记录不能为空";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckId(model.Id))
                {
                    msg   = "资产编号只能为数字";
                    check = false;
                    return(check);
                }
                if (!Utility.CheckTime(model.scrap_date))
                {
                    msg   = "时间格式不正确";
                    check = false;
                    return(check);
                }
            }

            return(check);
        }
Esempio n. 6
0
 //显示数据函数
 public DataTable GetList(string strWhere, Model.Contact model)
 {
     return(dal.GetList(strWhere, model));
 }
 public void change_scrap_time(Model.Contact model)
 {
     SQLDAL.Change.change_scrap_time(model);
 }
 //修改summary表的剩余价值(当修改减值表或者累计折扣表)
 public void change_remain_state_change(Model.Contact model)
 {
     SQLDAL.Change.change_remain_state_change(model);
 }
 //修改summary表的减值金额
 public void change_dc_state(Model.Contact model)
 {
     SQLDAL.Change.change_dc_state(model);
 }
 //修改summary表的归属部门
 public void change_dp(Model.Contact model)
 {
     SQLDAL.Change.change_dp(model);
 }