Beispiel #1
0
        /// <summary>
        /// 验证登录名是否已经存在
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns></returns>
        public int IsLoginNameExisits(string loginName)
        {
            string       sql = "select count(*) from person where ploginname=@name";
            SqlParameter p1  = new SqlParameter("name", loginName);

            return(SqlHelper.ExcuteScalar <int>(sql, p1));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="Cutno"></param>
        /// <returns></returns>

        public string GetColor(string myCutNo)
        {
            string       sql = "select  Code from T_StyleCodeinfo where CutNo=@CutNo";
            SqlParameter p1  = new SqlParameter("CutNo", myCutNo);

            return(SqlHelper.ExcuteScalar <string>(sql, p1));
        }
Beispiel #3
0
        /// <summary>
        /// 验证日期其是否已经存在
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public int IsDateExist(DateTime date)
        {
            string       sql = "select count(*) from doc_calendar where  date=@date";
            SqlParameter p1  = new SqlParameter("date", date);

            return(SqlHelper.ExcuteScalar <int>(sql, p1));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="Cutno"></param>
        /// <returns></returns>

        public string GetInnerBarcode(string name, string color, string size, string type)
        {
            string sql = @" 
           select InnerBarcode from  doc_InnerBox
             where  Name=@Name and Color=@Color and Size=@Size and Type=@Type 
            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@Name", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(name)
                },
                new SqlParameter("@Color", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(color)
                },
                new SqlParameter("@Size", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(size)
                },
                new SqlParameter("@Type", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(type)
                }
            };
            return(SqlHelper.ExcuteScalar <string>(sql, ps));
        }
        /// <summary>
        /// 验证內盒條碼基本資料是否存在
        /// </summary>
        /// <param name="name,color,size"></param>
        /// <returns></returns>
        public int IsInnerBoxExisits(string name, string color, string size)
        {
            string sql = @"
                select count(*) from doc_InnerBox  where Name=@Name and Color=@Color and Size=@Size
                ";

            SqlParameter[] ps =
            {
                //      new SqlParameter("@Name",name),
                //   new SqlParameter("@Color",color),
                //new SqlParameter("@Size",size)

                new SqlParameter("@Name", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(name)
                },
                new SqlParameter("@Color", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(color)
                },
                new SqlParameter("@Size", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(size)
                }
            };
            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
Beispiel #6
0
        /// <summary>
        /// 验证登录名是否已经存在
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public int IsCodeExisits(string code)
        {
            string       sql = "select count(*) from doc_Style  where Code=@Code";
            SqlParameter p1  = new SqlParameter("Code", code);

            return(SqlHelper.ExcuteScalar <int>(sql, p1));
        }
        /// <summary>
        ///  形体大类 可能一个工厂型体会有多个客户型体 ,所以判断有没有客户型体Name
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public int IsStyleBaseExisits(string name)
        {
            //     string[] mycode = code.Split('/');
            //   string stylebase = mycode[0].ToString().Trim();
            string       sql = "select count(*) from doc_StyleBase  where name=@name";
            SqlParameter p1  = new SqlParameter("Name", name);

            return(SqlHelper.ExcuteScalar <int>(sql, p1));
        }
Beispiel #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="></param>
        /// <returns></returns>
        public int getnormalday(int month, string year)
        {
            string sql = "select count(*) from doc_calendar where worktime <> 0 and weekday <>6 and  month =@month  and year =@year";

            SqlParameter[] ps =
            {
                new SqlParameter("month", month),
                new SqlParameter("year",  year)
            };
            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="></param>
        /// <returns></returns>
        public int getmonthtime(int month, string year)
        {
            string sql = "select sum(worktime) from doc_calendar where month = @month   and year =@year";

            SqlParameter[] ps =
            {
                new SqlParameter("month", month),
                new SqlParameter("year",  year)
            };
            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
        /// 验证型体大类是否存在
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public string GetMOrderDate(string customstylecode)
        {
            string sql = @"
                select  OrderDate   from doc_Order  
                where  CustomStyleCode = @CustomStyleCode   
        ";

            SqlParameter[] ps =
            {
                new SqlParameter("@CustomStyleCode", customstylecode)
            };
            return(SqlHelper.ExcuteScalar <string>(sql, ps));
        }
        /// 验证型体大类是否存在
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public int?GetScanOut(string cartonbarcode, string customstylecode)
        {
            string sql = @"
                select   Top 1 ScanOut+1  from doc_PackListShip 
                where CartonBarcode = @CartonBarcode and CustomStyleCode = @CustomStyleCode   
        ";

            SqlParameter[] ps =
            {
                new SqlParameter("@CartonBarcode",   cartonbarcode),
                new SqlParameter("@CustomStyleCode", customstylecode)
            };
            return(SqlHelper.ExcuteScalar <int?>(sql, ps));
        }
Beispiel #12
0
        /// <summary>  string GetSBNewCodeToSS(string yyyymm, string style)
        /// 尺码只需要从型体中找出大于该订单年月(表示有)的,新型体配色对应的 新型体中 最小的日期,(后面的就变成旧尺码)
        /// </summary>
        /// <param name="yyyymm"></param>
        /// <param name="style"></param>
        /// <returns></returns>
        public string GetSBNewCodeToSS(string yyyymm, string style)
        {
            string sql = @"
  select min(newcode)  NewCode,Style from doc_StyleBase 
  where NewCode>=@NewCode and Style=@Style 
  group by Style

            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@NewCode", yyyymm),
                new SqlParameter("@Style",   style)
            };
            return(SqlHelper.ExcuteScalar <string>(sql, ps));
        }
        /// <summary>
        /// 获取部門AID
        /// </summary>
        /// <param name=></param>
        /// <returns></returns>
        public double?GetAID(int deptid)
        {
            string sql = @"
                      select top 1 AID from HR_Department where DeptID=@DeptID
            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@DeptID", SqlDbType.Int)
                {
                    Value = SqlHelper.FromDbValue(deptid)
                }
            };


            return(SqlHelper.ExcuteScalar <double?>(sql, ps));
        }
Beispiel #14
0
        /// <summary>
        ///  形体大类 可能一个工厂型体会有多个客户型体 ,所以判断有没有客户型体Name
        /// </summary>
        /// <param name="style","size"></param>
        /// <returns></returns>
        public int IsStyleSizeExisits(string style, string size)
        {
            string sql = "select count(*) from doc_StyleSize  where Style=@Style and Size=@Size ";

            SqlParameter[] ps =
            {
                new SqlParameter("@Style", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(style)
                },
                new SqlParameter("@Size", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(size)
                },
            };
            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
Beispiel #15
0
        public int GetPacklisttotalcount(string customstylecode)
        {
            string sql = @"
            select  sum(convert(int,TotalCount)) Packlisttotalcount from doc_PackList  where CustomStyleCode=@CustomStyleCode

            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.FromDbValue(customstylecode)
                }
            };


            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
Beispiel #16
0
        /// <summary>
        /// 比較OrderDate and NewCode 就可以知道是否為新型體        /
        /// </summary>
        /// <param name=></param>
        /// <returns></returns>
        public string GetSNewCode(string yyyymm, string code)
        {
            string sql = @"
	      select distinct NewCode=(select distinct OrderDate+' ' from T_StyleCodeInfo  b
            where OrderDate>=@OrderDate
		    and b.Name=a.Name for XML PATH('') ) ,Code
            from T_StyleCodeInfo a
            where OrderDate>=@OrderDate
			and Code=@Code
            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@OrderDate", yyyymm),
                new SqlParameter("@Code",      code)
            };
            return(SqlHelper.ExcuteScalar <string>(sql, ps));
        }
        /// <summary>
        /// 验证订单是否存在
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public int IsOrderSizeExisits(string customstylecode, string size)
        {
            string sql = @"
            select count(*) from doc_OrderSize  where CustomStyleCode=@CustomStyleCode  and Size=@Size
                ";

            SqlParameter[] ps =
            {
                new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(customstylecode)
                },
                new SqlParameter("@Size", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(size)
                }
            };

            return(SqlHelper.ExcuteScalar <int>(sql, ps));
        }
        /// <summary>
        /// 执行插入操作
        /// </summary>
        /// <param name="table">要插入的表</param>
        /// <param name="obj">实体对象</param>
        /// <param name="newID">返回插入新的ID</param>
        /// <returns>受影响的行数</returns>
        public static int Add(string table, object obj, out int newID)
        {
            newID = 0;
            int    res;
            string columnParas = string.Empty;
            string columnNames = BuildSql.GetSqlColumnAndSqlParams(table, out columnParas, false);
            string strSql      = "INSERT " + table + "(" + columnNames + ") values(" + columnParas + ");select @@IDENTITY";

            string[] pas = columnParas.Split(',');

            List <SqlParameter> paras = new List <SqlParameter>();//参数集合

            for (int i = 0; i < pas.Length; i++)
            {
                object       v  = BuildSql.GetProValue(obj, pas[i]); //返回属性类型的值
                SqlParameter pa = new SqlParameter(pas[i], v);       //创建集合对象元素
                paras.Add(pa);                                       //加入集合
            }
            res   = SqlHelper.ExcuteScalar(strSql, paras.ToArray());
            newID = res;
            return(res);
        }
        /// <summary>
        /// 获取指定条件的总条数
        /// </summary>
        /// <param name="table">数据表</param>
        /// <param name="sqlWhere">条件</param>
        /// <returns></returns>
        public static int GetCount(string table, string sqlWhere = "")
        {
            string strSql = "select count(*) from " + table + " " + sqlWhere + " ";

            return(SqlHelper.ExcuteScalar(strSql));
        }
Beispiel #20
0
        public string GetErrorUserPWD()
        {
            string sql = "select userpwd from T_role where loginname='Error' ";

            return(SqlHelper.ExcuteScalar <string>(sql));
        }