Exemplo n.º 1
0
        /// <summary>
        ///获取项目信息
        /// </summary>
        /// <returns></returns>
        public APIRst GetProjectInfo()
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetProjectInfo();
                ProVModel pm       = new ProVModel();
                if (dtSource.Rows.Count > 0)
                {
                    pm = new ProVModel()
                    {
                        Id       = CommFunc.ConvertDBNullToInt32(dtSource.Rows[0]["Co_id"]),
                        ProName  = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CoName"]),
                        Disabled = CommFunc.ConvertDBNullToInt32(dtSource.Rows[0]["Disabled"]),
                        Person   = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CustName"]),
                        ProAddr  = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CustAddr"]),
                        TelNo    = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["Mobile"]),
                        Area     = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["Area"]),
                        Remark   = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["Remark"]),
                    };
                }
                rst.data = pm;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取获取能源分类列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置项目信息
        /// </summary>
        /// <param name="pro"></param>
        /// <returns></returns>
        public int SetPro(ProVModel pro)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Clear();
            strSql.Append("select count(*) from v1_cust where Ledger=@Ledger and CoName=@CoName and Co_id!=@Co_id");
            object obj = SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger, CoName = pro.ProName, Co_id = pro.Id });

            if (CommFunc.ConvertDBNullToInt32(obj) > 0)
            {
                throw new Exception("项目信息名称:" + pro.ProName + "已存在");
            }
            if (pro.Id == 0)
            {
                strSql.Clear();
                strSql.Append("select max(Co_id)as Co_id from v1_cust where Ledger=@Ledger");
                obj    = SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger });
                pro.Id = CommFunc.ConvertDBNullToInt32(obj) + 1;
            }
            object params01 = new
            {
                Ledger    = this.Ledger,
                Co_id     = pro.Id,
                CoNo      = pro.Id,
                CoName    = pro.ProName,
                Parent_id = 0,
                CustAddr  = pro.ProAddr,
                CustName  = pro.Person,
                Mobile    = pro.TelNo,
                Remark    = pro.Remark,
                Disabled  = pro.Disabled,
                Attrib    = CoAttrib.Project,
                Layer     = 0,
                Area      = pro.Area,
                SysUid    = this.SysUid
            };

            ///////////////////////////////////////////////////
            strSql.Clear();
            strSql.Append("insert into v1_cust(Ledger,Co_id,CoNo,CoName,Disabled,Parent_id,Attrib,Layer,Create_by,Create_dt,Update_by,Update_dt)");
            strSql.Append("values(@Ledger,@Co_id,@CoNo,@CoName,@Disabled,@Parent_id,@Attrib,@Layer,@SysUid,now(),@SysUid,now())");
            strSql.Append("ON DUPLICATE KEY UPDATE CoNo=@CoNo,CoName=@CoName,Disabled=@Disabled,Update_by=@SysUid,Update_dt=now();");
            strSql.Append("insert into v1_custinfo(Ledger,Co_id,CustName,CustAddr,Mobile,Remark,Update_by,Update_dt)");
            strSql.Append("values(@Ledger,@Co_id,@CustName,@CustAddr,@Mobile,@Remark,@SysUid,now())");
            strSql.Append("ON DUPLICATE KEY UPDATE CustAddr=@CustAddr,CustName=@CustName,Mobile=@Mobile,Remark=@Remark,Update_by=@SysUid,Update_dt=now();");
            strSql.Append("update v1_custinfo set StrucName=GetCoOnStrucName(Ledger,Co_id) where Ledger=@Ledger and FIND_IN_SET(Co_id,GetCoChildList(Ledger,@Co_id));"); // 更新全名
            strSql.Append("insert into v1_custinfobuild (Ledger,Co_id,Area,Update_by,Update_dt)values(@Ledger,@Co_id,@Area,@SysUid,now())");
            strSql.Append("ON DUPLICATE KEY UPDATE Area=@Area,Update_by=@SysUid,Update_dt=now();");
            int cnt = SQLHelper.Execute(strSql.ToString(), params01);

            return(cnt);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设置项目信息信息
        /// </summary>
        /// <param name="pro">角色信息</param>
        /// <returns></returns>
        public APIRst SetPro(ProVModel pro)
        {
            APIRst rst = new APIRst();

            try
            {
                bll.SetPro(pro);
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("设置项目信息信息错误(SetPro):" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Exemplo n.º 4
0
 public APIRst SetPro(ProVModel pro)
 {
     return(infoHelper.SetPro(pro));
 }
Exemplo n.º 5
0
 public APIRst AddPro(ProVModel pro)
 {
     pro.Id = 0;
     return(infoHelper.SetPro(pro));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 设置项目信息
 /// </summary>
 /// <param name="pro"></param>
 /// <returns></returns>
 public int SetPro(ProVModel pro)
 {
     return(dal.SetPro(pro));
 }