コード例 #1
0
        /// <summary>
        /// 获取项目信息
        /// </summary>
        /// <param name="attrib"></param>
        /// <returns></returns>
        public DataTable GetVp_coinfo(CoAttribV2_1 attrib)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select a.Co_id,a.CoNo,a.CoName,a.CustAddr,a.Mobile,a.Parent_id,a.Remark,a.CoStrcName,a.Disabled,b.CoName as ParentName,a.Path");
            strSql.Append(" from vp_coinfo as a");
            strSql.Append(" left join v1_cust as b on a.Ledger=b.Ledger and a.Parent_id=b.Co_id");
            strSql.Append(" where a.Ledger=@Ledger and a.Attrib=@Attrib");
            return(SQLHelper.Query(strSql.ToString(), new { Ledger = this.Ledger, Attrib = (int)attrib }));
        }
コード例 #2
0
ファイル: HomeDAL.cs プロジェクト: ZQuanLi/Test
        /// <summary>
        /// 获取用电单元信息
        /// </summary>
        /// <param name="attrib"></param>
        /// <returns></returns>
        public DataTable GetVp_coinfo(CoAttribV2_1 attrib)
        {
            string        AreaPowerStr     = "";
            bool          IsCheckAreaPower = WHoleDAL.GetAreaPower(this.Ledger, this.SysUid, out AreaPowerStr);
            StringBuilder strSql           = new StringBuilder();

            strSql.Append("select a.Co_id,a.CoNo,a.CoName,a.CustAddr,a.Mobile,a.Parent_id,a.Remark,a.CoStrcName,a.Disabled,b.CoName as ParentName");
            strSql.Append(" from vp_coinfo as a");
            strSql.Append(" left join v1_cust as b on a.Ledger=b.Ledger and a.Parent_id=b.Co_id");
            strSql.Append(" where a.Ledger=@Ledger and a.Attrib=@Attrib");
            if (IsCheckAreaPower == true)
            {
                strSql.Append(" and FIND_IN_SET(a.Co_id,@AreaPowerStr)");
            }
            else
            {
                strSql.Append(" and FIND_IN_SET(a.Co_id,'-1')");//给-1:是无效值   为false时无权限
            }
            return(SQLHelper.Query(strSql.ToString(), new { Ledger = this.Ledger, Attrib = (int)attrib, AreaPowerStr = AreaPowerStr, SysUid = this.SysUid }));
        }
コード例 #3
0
        public int UpdateCoInfo(int co_id, string coNo, string coName, int parent_id, CoAttribV2_1 attrib, string custAddr, string mobile, string remark, int disabled)
        {
            StringBuilder strSql = new StringBuilder();
            int           layer  = 0;

            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 = coName, Co_id = co_id });

            if (CommFunc.ConvertDBNullToInt32(obj) > 0)
            {
                throw new Exception("名称:" + coName + "已存在");
            }

            if (parent_id != 0)
            {
                strSql.Clear();
                strSql.Append("select Layer from v1_cust where Ledger=@Ledger and Co_id=@Co_id");
                obj   = SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger, Co_id = parent_id });
                layer = CommFunc.ConvertDBNullToInt32(obj) + 1;
            }
            if (co_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 });
                co_id = CommFunc.ConvertDBNullToInt32(obj) + 1;
            }
            object params01 = new
            {
                Ledger    = this.Ledger,
                Co_id     = co_id,
                CoNo      = coNo,
                CoName    = coName,
                Parent_id = parent_id,
                CustAddr  = custAddr,
                Mobile    = mobile,
                Email     = "",
                Remark    = remark,
                Disabled  = disabled,
                Attrib    = (int)attrib,
                Layer     = layer,
                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,Parent_id=@Parent_id,Disabled=@Disabled,Update_by=@SysUid,Update_dt=now();");
            strSql.Append("insert into v1_custinfo(Ledger,Co_id,CustAddr,Mobile,Email,Remark,Update_by,Update_dt)");
            strSql.Append("values(@Ledger,@Co_id,@CustAddr,@Mobile,@Email,@Remark,@SysUid,now())");
            strSql.Append("ON DUPLICATE KEY UPDATE CustAddr=@CustAddr,Mobile=@Mobile,Email=@Email,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))"); // 更新全名
            int cnt = SQLHelper.Execute(strSql.ToString(), params01);

            return(cnt);
        }
コード例 #4
0
ファイル: MgrBLL.cs プロジェクト: ZQuanLi/Test
 public int UpdateCoInfo(int co_id, string coNo, string coName, int parent_id, CoAttribV2_1 attrib, string custAddr, string mobile, string remark, int disabled)
 {
     return(dal.UpdateCoInfo(co_id, coNo, coName, parent_id, attrib, custAddr, mobile, remark, disabled));
 }
コード例 #5
0
ファイル: MgrBLL.cs プロジェクト: ZQuanLi/Test
 /// <summary>
 /// 获取项目信息
 /// </summary>
 /// <param name="attrib"></param>
 /// <returns></returns>
 public DataTable GetVp_coinfo(CoAttribV2_1 attrib)
 {
     return(dal.GetVp_coinfo(attrib));
 }