Ejemplo n.º 1
0
        /// <summary>
        /// 根据硬盘序列号检查软件注册状态,如果没有注册信息,添加记录并返回空,并返回注册码
        /// </summary>
        /// <param name="HDID"></param>
        /// <returns></returns>
        public string CheckHDID(string HDID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(*) as qwe from system where (HDSerie=@HDID)");
            SqlParameter[] sps = { new SqlParameter("@HDID", HDID) };
            if (DbHelperSQL.GetSingle(strSql.ToString(), sps).ToString() == "0")
            {
                Hownet.Model.SysTem modST = new Hownet.Model.SysTem();
                modST.CompanyName  = "";
                modST.Fax          = "";
                modST.LinkMan      = "";
                modST.Phone        = "";
                modST.Registration = "";
                modST.HDSerie      = HDID;
                Add(modST);
                return(string.Empty);
            }
            else
            {
                string sql = "select Registration from system where (HDSerie=@HDID)";
                object obj = DbHelperSQL.GetSingle(sql, sps);
                return(obj.ToString());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="EmployeeID"></param>
        /// <param name="TypeID">0为当天,1为当月</param>
        /// <returns></returns>
        public DataSet GetSumAmount(int EmployeeID, int TypeID)
        {
            DateTime dtOne = DateTime.Today;
            DateTime dtTwo = dtOne.AddDays(1);

            if (TypeID == 1)
            {
                dtOne = DateTime.Today.AddDays(DateTime.Today.Day * -1 + 1);
            }

            if (TypeID == 1)
            {
                Hownet.DAL.SysTem   dalST = new SysTem();
                Hownet.Model.SysTem modST = dalST.GetModel(dalST.GetMaxId() - 1);
                if (modST.Registration.Trim() != string.Empty)
                {
                    dtOne = DateTime.Parse(dtOne.Year.ToString() + "-" + dtOne.Month.ToString() + "-" + modST.Registration);
                }
                else
                {
                    dtOne = DateTime.Parse(dtOne.Year.ToString() + "-" + dtOne.Month.ToString() + "-" + "01");
                }
            }
            if (dtOne > DateTime.Now.Date)
            {
                dtOne = dtOne.AddMonths(-1);
            }
            StringBuilder strSql = new StringBuilder();

            //  strSql.Append(" SELECT   Materiel.Name AS Materiel, Working.Name AS WorkingName, SUM(PayInfo.Amount) AS Amount, CONVERT(varchar(10), PayInfo.DateTime, 120) AS DateTime  FROM      PayInfo INNER JOIN ");
            //strSql.Append(" MiniEmp ON PayInfo.EmployeeID = MiniEmp.ID INNER JOIN Materiel ON PayInfo.MaterielID = Materiel.ID INNER JOIN ");
            // strSql.Append(" Working ON PayInfo.WorkingID = Working.ID WHERE   (PayInfo.DateTime < @dtTwo) AND (PayInfo.DateTime >= @dtOne) AND (MiniEmp.IDCardID = @CardID) ");
            //strSql.Append(" GROUP BY PayInfo.WorkingID, PayInfo.MaterielID, MiniEmp.Name, MiniEmp.Sn, Materiel.Name, Working.Name ORDER BY PayInfo.MaterielID, PayInfo.WorkingID, CONVERT(varchar(10), PayInfo.DateTime, 120)  ");
            strSql.Append("SELECT     Materiel.Name AS Materiel, Working.Name AS WorkingName, SUM(PayInfo.Amount) AS Amount,RIGHT( CONVERT(varchar(10), PayInfo.DateTime, 120),5) AS DateTime ");
            strSql.Append(" FROM         PayInfo INNER JOIN MiniEmp ON PayInfo.EmployeeID = MiniEmp.ID INNER JOIN Materiel ON PayInfo.MaterielID = Materiel.ID INNER JOIN ");
            strSql.Append(" Working ON PayInfo.WorkingID = Working.ID WHERE     (PayInfo.DateTime < @dtTwo) AND (PayInfo.DateTime >= @dtOne) AND (MiniEmp.IDCardID = @CardID) ");
            strSql.Append(" GROUP BY PayInfo.WorkingID, PayInfo.MaterielID, MiniEmp.Name, MiniEmp.Sn, Materiel.Name, Working.Name, CONVERT(varchar(10), PayInfo.DateTime, 120) ");
            strSql.Append(" ORDER BY DateTime, Materiel, WorkingName");

            SqlParameter[] sps = { new SqlParameter("@CardID", EmployeeID),
                                   new SqlParameter("@dtOne",  dtOne),
                                   new SqlParameter("@dtTwo",  dtTwo) };
            return(DbHelperSQL.Query(strSql.ToString(), sps));
        }
Ejemplo n.º 3
0
        public void UpDatabase()
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" Select Top 1 DataVer from System Order by ID Desc");
            string ssVer = string.Empty;

            try
            {
                ssVer = DbHelperSQL.GetSingle(strSql.ToString()).ToString();
            }
            catch
            {
                strSql.Remove(0, strSql.Length);
                strSql.Append("ALTER TABLE dbo.SysTem ADD	DataVer nvarchar(50) NOT NULL CONSTRAINT DF_SysTem_DataVer DEFAULT '1' ");
                DbHelperSQL.ExecuteSql(strSql.ToString());
                ssVer = "1";
            }
            if (ssVer == "1")
            {
                strSql.Remove(0, strSql.Length);
                strSql.Append(" ALTER TABLE dbo.Materiel ADD ");
                strSql.Append(" TiaoMaH nvarchar(50) NOT NULL CONSTRAINT DF_Materiel_TiaoMaH DEFAULT '',");
                strSql.Append(" ChengBengJ decimal(18, 2) NOT NULL CONSTRAINT DF_Materiel_ChengBengJ DEFAULT 0,");
                strSql.Append(" LingShouJia decimal(18, 2) NOT NULL CONSTRAINT DF_Materiel_LingShouJia DEFAULT 0,");
                strSql.Append(" YiJiDaiLiJia decimal(18, 2) NOT NULL CONSTRAINT DF_Materiel_YiJiDaiLiJia DEFAULT 0,");
                strSql.Append(" ErJiDaiLiJia decimal(18, 2) NOT NULL CONSTRAINT DF_Materiel_ErJiDaiLiJia DEFAULT 0, ");
                strSql.Append(" SanJiDaiLiJia decimal(18, 2) NOT NULL CONSTRAINT DF_Materiel_SanJiDaiLiJia DEFAULT 0");
                DbHelperSQL.ExecuteSql(strSql.ToString());


                Hownet.Model.SysTem modST = GetModel(GetMaxId() - 1);
                modST.DataVer = "2";
                Update(modST);
            }
            if (ssVer == "2")
            {
                strSql.Remove(0, strSql.Length);
                strSql.Append(" ");
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 转入生产计划
 /// </summary>
 /// <param name="SaleID"></param>
 /// <returns></returns>
 public int ToPlan(int SaleID, int FillMan)
 {
     try
     {
         DataTable                   dt    = GetList("(ID=" + SaleID + ")").Tables[0];
         Hownet.DAL.SysTem           dalST = new SysTem();
         Hownet.Model.SysTem         modST = dalST.GetModel(dalST.GetMaxId());
         Hownet.DAL.ProductionPlan   dalPP = new Hownet.DAL.ProductionPlan();
         Hownet.Model.ProductionPlan modPP = new Hownet.Model.ProductionPlan();
         modPP.SalesOrderInfoID = Convert.ToInt32(dt.Rows[0]["ID"]);
         modPP.MaterielID       = Convert.ToInt32(dt.Rows[0]["MaterielID"]);
         modPP.BrandID          = Convert.ToInt32(dt.Rows[0]["BrandID"]);
         //   modPP.Num = dalPP.NewNum(DateTime.Today, modST.NumType);
         dalPP.NewNum(DateTime.Today, modST.NumType);
         modPP.DateTime        = DateTime.Today;
         modPP.LastDate        = Convert.ToDateTime(dt.Rows[0]["LastDate"]);
         modPP.Remark          = dt.Rows[0]["Remark"].ToString();
         modPP.PWorkingID      = modPP.BomID = 0;
         modPP.CompanyID       = Convert.ToInt32(dt.Rows[0]["CompanyID"]);
         modPP.IsTicket        = modPP.IsBom = false;
         modPP.VerifyDate      = Convert.ToDateTime("1900-1-1");
         modPP.VerifyMan       = 0;
         modPP.DeparmentID     = 0;
         modPP.UpData          = 1;
         modPP.FillDate        = DateTime.Today;
         modPP.FilMan          = FillMan;
         modPP.TicketDate      = Convert.ToDateTime("1900-1-1");
         modPP.BedNO           = string.Empty;
         modPP.PackingMethodID = Convert.ToInt32(dt.Rows[0]["PackingMethodID"]);
         modPP.SewingRemark    = dt.Rows[0]["SewingRemark"].ToString();
         modPP.TypeID          = modPP.ParentID = 0;
         modPP.ParentID        = 0;
         return(dalPP.Add(modPP));
     }
     catch //(Exception ex)
     {
         return(0);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hownet.Model.SysTem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SysTem(");
            strSql.Append("CompanyName,LinkMan,Phone,Fax,HDSerie,Registration,BanKName,BankNO,BankUserName,Address,Direct2Depot,Sell4Depot,AutoClient,BoxOrPic,NumType,Mobile,SellMoney,CustOder,NotPermissions,DepotAllowNegative,IsChangedSales,BackDepotWorking,OderOne,OderTwo,OderThree,AutoCaicBoardWages,DefaultRawDepot,DefaultDepot,IsShowMoney,CompanyByUser,DoubleNotDefaultWTNum,OrderDays,OrderNeedEat,IsCheckNoWork,IsCanEditAmount,IsAutoClose,IsTicketNotNeedCaic,IsShowOutEmp,DataVer,MaterielByTask,SumByWorking)");
            strSql.Append(" values (");
            strSql.Append("@CompanyName,@LinkMan,@Phone,@Fax,@HDSerie,@Registration,@BanKName,@BankNO,@BankUserName,@Address,@Direct2Depot,@Sell4Depot,@AutoClient,@BoxOrPic,@NumType,@Mobile,@SellMoney,@CustOder,@NotPermissions,@DepotAllowNegative,@IsChangedSales,@BackDepotWorking,@OderOne,@OderTwo,@OderThree,@AutoCaicBoardWages,@DefaultRawDepot,@DefaultDepot,@IsShowMoney,@CompanyByUser,@DoubleNotDefaultWTNum,@OrderDays,@OrderNeedEat,@IsCheckNoWork,@IsCanEditAmount,@IsAutoClose,@IsTicketNotNeedCaic,@IsShowOutEmp,@DataVer,@MaterielByTask,@SumByWorking)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyName",           SqlDbType.NVarChar,   50),
                new SqlParameter("@LinkMan",               SqlDbType.NVarChar,   12),
                new SqlParameter("@Phone",                 SqlDbType.NVarChar,   50),
                new SqlParameter("@Fax",                   SqlDbType.NVarChar,   50),
                new SqlParameter("@HDSerie",               SqlDbType.NVarChar,   50),
                new SqlParameter("@Registration",          SqlDbType.NVarChar, 2000),
                new SqlParameter("@BanKName",              SqlDbType.NVarChar,  255),
                new SqlParameter("@BankNO",                SqlDbType.NVarChar,  255),
                new SqlParameter("@BankUserName",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Address",               SqlDbType.NVarChar,  255),
                new SqlParameter("@Direct2Depot",          SqlDbType.Bit,         1),
                new SqlParameter("@Sell4Depot",            SqlDbType.Bit,         1),
                new SqlParameter("@AutoClient",            SqlDbType.Bit,         1),
                new SqlParameter("@BoxOrPic",              SqlDbType.Bit,         1),
                new SqlParameter("@NumType",               SqlDbType.Int,         4),
                new SqlParameter("@Mobile",                SqlDbType.NVarChar,  255),
                new SqlParameter("@SellMoney",             SqlDbType.Int,         4),
                new SqlParameter("@CustOder",              SqlDbType.Bit,         1),
                new SqlParameter("@NotPermissions",        SqlDbType.Bit,         1),
                new SqlParameter("@DepotAllowNegative",    SqlDbType.Bit,         1),
                new SqlParameter("@IsChangedSales",        SqlDbType.Bit,         1),
                new SqlParameter("@BackDepotWorking",      SqlDbType.Int,         4),
                new SqlParameter("@OderOne",               SqlDbType.Int,         4),
                new SqlParameter("@OderTwo",               SqlDbType.Int,         4),
                new SqlParameter("@OderThree",             SqlDbType.Int,         4),
                new SqlParameter("@AutoCaicBoardWages",    SqlDbType.Bit,         1),
                new SqlParameter("@DefaultRawDepot",       SqlDbType.Int,         4),
                new SqlParameter("@DefaultDepot",          SqlDbType.Int,         4),
                new SqlParameter("@IsShowMoney",           SqlDbType.Bit,         1),
                new SqlParameter("@CompanyByUser",         SqlDbType.Bit,         1),
                new SqlParameter("@DoubleNotDefaultWTNum", SqlDbType.Decimal,     9),
                new SqlParameter("@OrderDays",             SqlDbType.Int,         4),
                new SqlParameter("@OrderNeedEat",          SqlDbType.Bit,         1),
                new SqlParameter("@IsCheckNoWork",         SqlDbType.Bit,         1),
                new SqlParameter("@IsCanEditAmount",       SqlDbType.Bit,         1),
                new SqlParameter("@IsAutoClose",           SqlDbType.Bit,         1),
                new SqlParameter("@IsTicketNotNeedCaic",   SqlDbType.Bit,         1),
                new SqlParameter("@IsShowOutEmp",          SqlDbType.Bit,         1),
                new SqlParameter("@DataVer",               SqlDbType.NVarChar,   50),
                new SqlParameter("@MaterielByTask",        SqlDbType.Bit,         1),
                new SqlParameter("@SumByWorking",          SqlDbType.Bit, 1)
            };
            parameters[0].Value  = model.CompanyName;
            parameters[1].Value  = model.LinkMan;
            parameters[2].Value  = model.Phone;
            parameters[3].Value  = model.Fax;
            parameters[4].Value  = model.HDSerie;
            parameters[5].Value  = model.Registration;
            parameters[6].Value  = model.BanKName;
            parameters[7].Value  = model.BankNO;
            parameters[8].Value  = model.BankUserName;
            parameters[9].Value  = model.Address;
            parameters[10].Value = model.Direct2Depot;
            parameters[11].Value = model.Sell4Depot;
            parameters[12].Value = model.AutoClient;
            parameters[13].Value = model.BoxOrPic;
            parameters[14].Value = model.NumType;
            parameters[15].Value = model.Mobile;
            parameters[16].Value = model.SellMoney;
            parameters[17].Value = model.CustOder;
            parameters[18].Value = model.NotPermissions;
            parameters[19].Value = model.DepotAllowNegative;
            parameters[20].Value = model.IsChangedSales;
            parameters[21].Value = model.BackDepotWorking;
            parameters[22].Value = model.OderOne;
            parameters[23].Value = model.OderTwo;
            parameters[24].Value = model.OderThree;
            parameters[25].Value = model.AutoCaicBoardWages;
            parameters[26].Value = model.DefaultRawDepot;
            parameters[27].Value = model.DefaultDepot;
            parameters[28].Value = model.IsShowMoney;
            parameters[29].Value = model.CompanyByUser;
            parameters[30].Value = model.DoubleNotDefaultWTNum;
            parameters[31].Value = model.OrderDays;
            parameters[32].Value = model.OrderNeedEat;
            parameters[33].Value = model.IsCheckNoWork;
            parameters[34].Value = model.IsCanEditAmount;
            parameters[35].Value = model.IsAutoClose;
            parameters[36].Value = model.IsTicketNotNeedCaic;
            parameters[37].Value = model.IsShowOutEmp;
            parameters[38].Value = model.DataVer;
            parameters[39].Value = model.MaterielByTask;
            parameters[40].Value = model.SumByWorking;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hownet.Model.SysTem GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CompanyName,LinkMan,Phone,Fax,HDSerie,Registration,BanKName,BankNO,BankUserName,Address,Direct2Depot,Sell4Depot,AutoClient,BoxOrPic,NumType,Mobile,SellMoney,CustOder,NotPermissions,DepotAllowNegative,IsChangedSales,BackDepotWorking,OderOne,OderTwo,OderThree,AutoCaicBoardWages,DefaultRawDepot,DefaultDepot,IsShowMoney,CompanyByUser,DoubleNotDefaultWTNum,OrderDays,OrderNeedEat,IsCheckNoWork,IsCanEditAmount,IsAutoClose,IsTicketNotNeedCaic,IsShowOutEmp,DataVer,MaterielByTask,SumByWorking from SysTem ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Hownet.Model.SysTem model = new Hownet.Model.SysTem();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.CompanyName  = ds.Tables[0].Rows[0]["CompanyName"].ToString();
                model.LinkMan      = ds.Tables[0].Rows[0]["LinkMan"].ToString();
                model.Phone        = ds.Tables[0].Rows[0]["Phone"].ToString();
                model.Fax          = ds.Tables[0].Rows[0]["Fax"].ToString();
                model.HDSerie      = ds.Tables[0].Rows[0]["HDSerie"].ToString();
                model.Registration = ds.Tables[0].Rows[0]["Registration"].ToString();
                model.BanKName     = ds.Tables[0].Rows[0]["BanKName"].ToString();
                model.BankNO       = ds.Tables[0].Rows[0]["BankNO"].ToString();
                model.BankUserName = ds.Tables[0].Rows[0]["BankUserName"].ToString();
                model.Address      = ds.Tables[0].Rows[0]["Address"].ToString();
                if (ds.Tables[0].Rows[0]["Direct2Depot"] != null && ds.Tables[0].Rows[0]["Direct2Depot"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["Direct2Depot"].ToString() == "1") || (ds.Tables[0].Rows[0]["Direct2Depot"].ToString().ToLower() == "true"))
                    {
                        model.Direct2Depot = true;
                    }
                    else
                    {
                        model.Direct2Depot = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["Sell4Depot"] != null && ds.Tables[0].Rows[0]["Sell4Depot"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["Sell4Depot"].ToString() == "1") || (ds.Tables[0].Rows[0]["Sell4Depot"].ToString().ToLower() == "true"))
                    {
                        model.Sell4Depot = true;
                    }
                    else
                    {
                        model.Sell4Depot = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["AutoClient"] != null && ds.Tables[0].Rows[0]["AutoClient"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["AutoClient"].ToString() == "1") || (ds.Tables[0].Rows[0]["AutoClient"].ToString().ToLower() == "true"))
                    {
                        model.AutoClient = true;
                    }
                    else
                    {
                        model.AutoClient = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["BoxOrPic"] != null && ds.Tables[0].Rows[0]["BoxOrPic"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["BoxOrPic"].ToString() == "1") || (ds.Tables[0].Rows[0]["BoxOrPic"].ToString().ToLower() == "true"))
                    {
                        model.BoxOrPic = true;
                    }
                    else
                    {
                        model.BoxOrPic = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["NumType"] != null && ds.Tables[0].Rows[0]["NumType"].ToString() != "")
                {
                    model.NumType = int.Parse(ds.Tables[0].Rows[0]["NumType"].ToString());
                }
                model.Mobile = ds.Tables[0].Rows[0]["Mobile"].ToString();
                if (ds.Tables[0].Rows[0]["SellMoney"] != null && ds.Tables[0].Rows[0]["SellMoney"].ToString() != "")
                {
                    model.SellMoney = int.Parse(ds.Tables[0].Rows[0]["SellMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CustOder"] != null && ds.Tables[0].Rows[0]["CustOder"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["CustOder"].ToString() == "1") || (ds.Tables[0].Rows[0]["CustOder"].ToString().ToLower() == "true"))
                    {
                        model.CustOder = true;
                    }
                    else
                    {
                        model.CustOder = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["NotPermissions"] != null && ds.Tables[0].Rows[0]["NotPermissions"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["NotPermissions"].ToString() == "1") || (ds.Tables[0].Rows[0]["NotPermissions"].ToString().ToLower() == "true"))
                    {
                        model.NotPermissions = true;
                    }
                    else
                    {
                        model.NotPermissions = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["DepotAllowNegative"] != null && ds.Tables[0].Rows[0]["DepotAllowNegative"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["DepotAllowNegative"].ToString() == "1") || (ds.Tables[0].Rows[0]["DepotAllowNegative"].ToString().ToLower() == "true"))
                    {
                        model.DepotAllowNegative = true;
                    }
                    else
                    {
                        model.DepotAllowNegative = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsChangedSales"] != null && ds.Tables[0].Rows[0]["IsChangedSales"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsChangedSales"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsChangedSales"].ToString().ToLower() == "true"))
                    {
                        model.IsChangedSales = true;
                    }
                    else
                    {
                        model.IsChangedSales = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["BackDepotWorking"] != null && ds.Tables[0].Rows[0]["BackDepotWorking"].ToString() != "")
                {
                    model.BackDepotWorking = int.Parse(ds.Tables[0].Rows[0]["BackDepotWorking"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OderOne"] != null && ds.Tables[0].Rows[0]["OderOne"].ToString() != "")
                {
                    model.OderOne = int.Parse(ds.Tables[0].Rows[0]["OderOne"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OderTwo"] != null && ds.Tables[0].Rows[0]["OderTwo"].ToString() != "")
                {
                    model.OderTwo = int.Parse(ds.Tables[0].Rows[0]["OderTwo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OderThree"] != null && ds.Tables[0].Rows[0]["OderThree"].ToString() != "")
                {
                    model.OderThree = int.Parse(ds.Tables[0].Rows[0]["OderThree"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AutoCaicBoardWages"] != null && ds.Tables[0].Rows[0]["AutoCaicBoardWages"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["AutoCaicBoardWages"].ToString() == "1") || (ds.Tables[0].Rows[0]["AutoCaicBoardWages"].ToString().ToLower() == "true"))
                    {
                        model.AutoCaicBoardWages = true;
                    }
                    else
                    {
                        model.AutoCaicBoardWages = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["DefaultRawDepot"] != null && ds.Tables[0].Rows[0]["DefaultRawDepot"].ToString() != "")
                {
                    model.DefaultRawDepot = int.Parse(ds.Tables[0].Rows[0]["DefaultRawDepot"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DefaultDepot"] != null && ds.Tables[0].Rows[0]["DefaultDepot"].ToString() != "")
                {
                    model.DefaultDepot = int.Parse(ds.Tables[0].Rows[0]["DefaultDepot"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsShowMoney"] != null && ds.Tables[0].Rows[0]["IsShowMoney"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsShowMoney"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsShowMoney"].ToString().ToLower() == "true"))
                    {
                        model.IsShowMoney = true;
                    }
                    else
                    {
                        model.IsShowMoney = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["CompanyByUser"] != null && ds.Tables[0].Rows[0]["CompanyByUser"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["CompanyByUser"].ToString() == "1") || (ds.Tables[0].Rows[0]["CompanyByUser"].ToString().ToLower() == "true"))
                    {
                        model.CompanyByUser = true;
                    }
                    else
                    {
                        model.CompanyByUser = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["DoubleNotDefaultWTNum"] != null && ds.Tables[0].Rows[0]["DoubleNotDefaultWTNum"].ToString() != "")
                {
                    model.DoubleNotDefaultWTNum = decimal.Parse(ds.Tables[0].Rows[0]["DoubleNotDefaultWTNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderDays"] != null && ds.Tables[0].Rows[0]["OrderDays"].ToString() != "")
                {
                    model.OrderDays = int.Parse(ds.Tables[0].Rows[0]["OrderDays"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderNeedEat"] != null && ds.Tables[0].Rows[0]["OrderNeedEat"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["OrderNeedEat"].ToString() == "1") || (ds.Tables[0].Rows[0]["OrderNeedEat"].ToString().ToLower() == "true"))
                    {
                        model.OrderNeedEat = true;
                    }
                    else
                    {
                        model.OrderNeedEat = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsCheckNoWork"] != null && ds.Tables[0].Rows[0]["IsCheckNoWork"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsCheckNoWork"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsCheckNoWork"].ToString().ToLower() == "true"))
                    {
                        model.IsCheckNoWork = true;
                    }
                    else
                    {
                        model.IsCheckNoWork = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsCanEditAmount"] != null && ds.Tables[0].Rows[0]["IsCanEditAmount"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsCanEditAmount"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsCanEditAmount"].ToString().ToLower() == "true"))
                    {
                        model.IsCanEditAmount = true;
                    }
                    else
                    {
                        model.IsCanEditAmount = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsAutoClose"] != null && ds.Tables[0].Rows[0]["IsAutoClose"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsAutoClose"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsAutoClose"].ToString().ToLower() == "true"))
                    {
                        model.IsAutoClose = true;
                    }
                    else
                    {
                        model.IsAutoClose = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsTicketNotNeedCaic"] != null && ds.Tables[0].Rows[0]["IsTicketNotNeedCaic"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsTicketNotNeedCaic"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsTicketNotNeedCaic"].ToString().ToLower() == "true"))
                    {
                        model.IsTicketNotNeedCaic = true;
                    }
                    else
                    {
                        model.IsTicketNotNeedCaic = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsShowOutEmp"] != null && ds.Tables[0].Rows[0]["IsShowOutEmp"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsShowOutEmp"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsShowOutEmp"].ToString().ToLower() == "true"))
                    {
                        model.IsShowOutEmp = true;
                    }
                    else
                    {
                        model.IsShowOutEmp = false;
                    }
                }
                model.DataVer = ds.Tables[0].Rows[0]["DataVer"].ToString();
                if (ds.Tables[0].Rows[0]["MaterielByTask"] != null && ds.Tables[0].Rows[0]["MaterielByTask"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["MaterielByTask"].ToString() == "1") || (ds.Tables[0].Rows[0]["MaterielByTask"].ToString().ToLower() == "true"))
                    {
                        model.MaterielByTask = true;
                    }
                    else
                    {
                        model.MaterielByTask = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["SumByWorking"] != null && ds.Tables[0].Rows[0]["SumByWorking"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["SumByWorking"].ToString() == "1") || (ds.Tables[0].Rows[0]["SumByWorking"].ToString().ToLower() == "true"))
                    {
                        model.SumByWorking = true;
                    }
                    else
                    {
                        model.SumByWorking = false;
                    }
                }
                model.A = 1;
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hownet.Model.SysTem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SysTem set ");
            strSql.Append("CompanyName=@CompanyName,");
            strSql.Append("LinkMan=@LinkMan,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Fax=@Fax,");
            strSql.Append("HDSerie=@HDSerie,");
            strSql.Append("Registration=@Registration,");
            strSql.Append("BanKName=@BanKName,");
            strSql.Append("BankNO=@BankNO,");
            strSql.Append("BankUserName=@BankUserName,");
            strSql.Append("Address=@Address,");
            strSql.Append("Direct2Depot=@Direct2Depot,");
            strSql.Append("Sell4Depot=@Sell4Depot,");
            strSql.Append("AutoClient=@AutoClient,");
            strSql.Append("BoxOrPic=@BoxOrPic,");
            strSql.Append("NumType=@NumType,");
            strSql.Append("Mobile=@Mobile,");
            strSql.Append("SellMoney=@SellMoney,");
            strSql.Append("CustOder=@CustOder,");
            strSql.Append("NotPermissions=@NotPermissions,");
            strSql.Append("DepotAllowNegative=@DepotAllowNegative,");
            strSql.Append("IsChangedSales=@IsChangedSales,");
            strSql.Append("BackDepotWorking=@BackDepotWorking,");
            strSql.Append("OderOne=@OderOne,");
            strSql.Append("OderTwo=@OderTwo,");
            strSql.Append("OderThree=@OderThree,");
            strSql.Append("AutoCaicBoardWages=@AutoCaicBoardWages,");
            strSql.Append("DefaultRawDepot=@DefaultRawDepot,");
            strSql.Append("DefaultDepot=@DefaultDepot,");
            strSql.Append("IsShowMoney=@IsShowMoney,");
            strSql.Append("CompanyByUser=@CompanyByUser,");
            strSql.Append("DoubleNotDefaultWTNum=@DoubleNotDefaultWTNum,");
            strSql.Append("OrderDays=@OrderDays,");
            strSql.Append("OrderNeedEat=@OrderNeedEat,");
            strSql.Append("IsCheckNoWork=@IsCheckNoWork,");
            strSql.Append("IsCanEditAmount=@IsCanEditAmount,");
            strSql.Append("IsAutoClose=@IsAutoClose,");
            strSql.Append("IsTicketNotNeedCaic=@IsTicketNotNeedCaic,");
            strSql.Append("IsShowOutEmp=@IsShowOutEmp,");
            strSql.Append("DataVer=@DataVer,");
            strSql.Append("MaterielByTask=@MaterielByTask,");
            strSql.Append("SumByWorking=@SumByWorking");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyName",           SqlDbType.NVarChar,   50),
                new SqlParameter("@LinkMan",               SqlDbType.NVarChar,   12),
                new SqlParameter("@Phone",                 SqlDbType.NVarChar,   50),
                new SqlParameter("@Fax",                   SqlDbType.NVarChar,   50),
                new SqlParameter("@HDSerie",               SqlDbType.NVarChar,   50),
                new SqlParameter("@Registration",          SqlDbType.NVarChar, 2000),
                new SqlParameter("@BanKName",              SqlDbType.NVarChar,  255),
                new SqlParameter("@BankNO",                SqlDbType.NVarChar,  255),
                new SqlParameter("@BankUserName",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Address",               SqlDbType.NVarChar,  255),
                new SqlParameter("@Direct2Depot",          SqlDbType.Bit,         1),
                new SqlParameter("@Sell4Depot",            SqlDbType.Bit,         1),
                new SqlParameter("@AutoClient",            SqlDbType.Bit,         1),
                new SqlParameter("@BoxOrPic",              SqlDbType.Bit,         1),
                new SqlParameter("@NumType",               SqlDbType.Int,         4),
                new SqlParameter("@Mobile",                SqlDbType.NVarChar,  255),
                new SqlParameter("@SellMoney",             SqlDbType.Int,         4),
                new SqlParameter("@CustOder",              SqlDbType.Bit,         1),
                new SqlParameter("@NotPermissions",        SqlDbType.Bit,         1),
                new SqlParameter("@DepotAllowNegative",    SqlDbType.Bit,         1),
                new SqlParameter("@IsChangedSales",        SqlDbType.Bit,         1),
                new SqlParameter("@BackDepotWorking",      SqlDbType.Int,         4),
                new SqlParameter("@OderOne",               SqlDbType.Int,         4),
                new SqlParameter("@OderTwo",               SqlDbType.Int,         4),
                new SqlParameter("@OderThree",             SqlDbType.Int,         4),
                new SqlParameter("@AutoCaicBoardWages",    SqlDbType.Bit,         1),
                new SqlParameter("@DefaultRawDepot",       SqlDbType.Int,         4),
                new SqlParameter("@DefaultDepot",          SqlDbType.Int,         4),
                new SqlParameter("@IsShowMoney",           SqlDbType.Bit,         1),
                new SqlParameter("@CompanyByUser",         SqlDbType.Bit,         1),
                new SqlParameter("@DoubleNotDefaultWTNum", SqlDbType.Decimal,     9),
                new SqlParameter("@OrderDays",             SqlDbType.Int,         4),
                new SqlParameter("@OrderNeedEat",          SqlDbType.Bit,         1),
                new SqlParameter("@IsCheckNoWork",         SqlDbType.Bit,         1),
                new SqlParameter("@IsCanEditAmount",       SqlDbType.Bit,         1),
                new SqlParameter("@IsAutoClose",           SqlDbType.Bit,         1),
                new SqlParameter("@IsTicketNotNeedCaic",   SqlDbType.Bit,         1),
                new SqlParameter("@IsShowOutEmp",          SqlDbType.Bit,         1),
                new SqlParameter("@DataVer",               SqlDbType.NVarChar,   50),
                new SqlParameter("@MaterielByTask",        SqlDbType.Bit,         1),
                new SqlParameter("@SumByWorking",          SqlDbType.Bit,         1),
                new SqlParameter("@ID",                    SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.CompanyName;
            parameters[1].Value  = model.LinkMan;
            parameters[2].Value  = model.Phone;
            parameters[3].Value  = model.Fax;
            parameters[4].Value  = model.HDSerie;
            parameters[5].Value  = model.Registration;
            parameters[6].Value  = model.BanKName;
            parameters[7].Value  = model.BankNO;
            parameters[8].Value  = model.BankUserName;
            parameters[9].Value  = model.Address;
            parameters[10].Value = model.Direct2Depot;
            parameters[11].Value = model.Sell4Depot;
            parameters[12].Value = model.AutoClient;
            parameters[13].Value = model.BoxOrPic;
            parameters[14].Value = model.NumType;
            parameters[15].Value = model.Mobile;
            parameters[16].Value = model.SellMoney;
            parameters[17].Value = model.CustOder;
            parameters[18].Value = model.NotPermissions;
            parameters[19].Value = model.DepotAllowNegative;
            parameters[20].Value = model.IsChangedSales;
            parameters[21].Value = model.BackDepotWorking;
            parameters[22].Value = model.OderOne;
            parameters[23].Value = model.OderTwo;
            parameters[24].Value = model.OderThree;
            parameters[25].Value = model.AutoCaicBoardWages;
            parameters[26].Value = model.DefaultRawDepot;
            parameters[27].Value = model.DefaultDepot;
            parameters[28].Value = model.IsShowMoney;
            parameters[29].Value = model.CompanyByUser;
            parameters[30].Value = model.DoubleNotDefaultWTNum;
            parameters[31].Value = model.OrderDays;
            parameters[32].Value = model.OrderNeedEat;
            parameters[33].Value = model.IsCheckNoWork;
            parameters[34].Value = model.IsCanEditAmount;
            parameters[35].Value = model.IsAutoClose;
            parameters[36].Value = model.IsTicketNotNeedCaic;
            parameters[37].Value = model.IsShowOutEmp;
            parameters[38].Value = model.DataVer;
            parameters[39].Value = model.MaterielByTask;
            parameters[40].Value = model.SumByWorking;
            parameters[41].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 取得工人工资及明细
        /// </summary>
        /// <param name="MainID"></param>
        /// <returns></returns>
        public DataSet GetEmpPay(int MainID)
        {
            DataSet       ds     = new DataSet();
            DataSet       dsInfo = new DataSet();
            StringBuilder strSql = new StringBuilder();

            //strSql.Append("select ID,(SELECT BegingDate FROM PayMain WHERE (ID = Pay.MainID)) AS BegingDate, ");
            //strSql.Append(" (SELECT EndDate FROM PayMain AS PayMain_1 WHERE (ID = Pay.MainID)) AS EndDate,(select Departmentname from Department where (Departmentid=(select DepartmentID from employee where (employeeid=pay. EmployeeID)))) as DepartmentName , ");
            //strSql.Append("(select employeename from employee where (employeeid=pay.employeeid)) as EmployeeName, (select Sn from employee as qwe where (employeeid=pay.employeeid)) as Sn,Month,LastRemain,Repair,BoardWages,Payment,Fact,Remain,MainID,IsEnd,EmployeeID ");
            //strSql.Append(" FROM Pay where (MainID=@MainID)");
            //strSql.Append(" SELECT Pay.ID, (SELECT BegingDate FROM PayMain WHERE (ID = Pay.MainID)) AS BegingDate, ");
            //strSql.Append(" (SELECT EndDate FROM PayMain AS PayMain_1 WHERE (ID = Pay.MainID)) AS EndDate, 1 as A,");
            //strSql.Append(" (SELECT DepartmentName FROM Department WHERE (DepartmentID = Employee_2.DepartmentID)) ");
            //strSql.Append(" AS DepartmentName, Pay.Month, Pay.LastRemain, Pay.Repair, Pay.BoardWages, Pay.Payment, ");
            //strSql.Append(" Pay.Fact, Pay.Remain, Pay.MainID, Pay.IsEnd, Pay.EmployeeID, Employee_2.EmployeeName,  ");
            //strSql.Append(" Employee_2.Sn, (SELECT OtherTypeName FROM OtherType WHERE (OtherTypeID = Employee_2.PayID)) ");
            //strSql.Append(" AS PayName, Employee_2.LassMoney, Employee_2.Royalty, Employee_2.PayID FROM Pay INNER JOIN ");
            //strSql.Append(" Employee AS Employee_2 ON Pay.EmployeeID = Employee_2.EmployeeID WHERE (Pay.MainID = @MainID)");


            //strSql.Append("SELECT   Pay.ID, 0 as PayID,0 as LassMoney,0 as Royalty,(SELECT   BegingDate FROM      PayMain WHERE   (ID = Pay.MainID)) AS BegingDate, (SELECT   EndDate ");
            //strSql.Append(" FROM      PayMain AS PayMain_1 WHERE   (ID = Pay.MainID)) AS EndDate, 1 AS A, (SELECT   Name FROM      Deparment ");
            //strSql.Append(" WHERE   (ID = MiniEmp.DepartmentID)) AS DepartmentName, Pay.Month, Pay.LastRemain,Pay.Fine, Pay.Repair,Pay.FullAttendance, Pay.BoardWages, Pay.Deposit,");
            //strSql.Append(" Pay.Payment, Pay.Fact, Pay.Remain, Pay.MainID, Pay.IsEnd, Pay.EmployeeID, MiniEmp.Name,  MiniEmp.Sn,MiniEmp.Deposit as AllDeposit FROM      Pay INNER JOIN ");
            //strSql.Append(" MiniEmp ON Pay.EmployeeID = MiniEmp.ID WHERE   (Pay.MainID = @MainID)");

            strSql.Append("SELECT   Pay.ID, (SELECT   BegingDate FROM      PayMain WHERE   (ID = Pay.MainID)) AS BegingDate, (SELECT   EndDate ");
            strSql.Append(" FROM      PayMain AS PayMain_1 WHERE   (ID = Pay.MainID)) AS EndDate, 1 AS A, Pay.Month, Pay.LastRemain, Pay.Fine, Pay.Repair, Pay.FullAttendance, ");
            strSql.Append(" Pay.BoardWages, Pay.Deposit, Pay.Payment, Pay.Fact, Pay.Remain, Pay.MainID, Pay.IsEnd, Pay.EmployeeID,  MiniEmp.DepartmentID, MiniEmp.Sn, ");
            strSql.Append(" MiniEmp.Deposit AS AllDeposit, MiniEmp.PayID, MiniEmp.LassMoney,MiniEmp.BankNO,MiniEmp.BankAccountName,MiniEmp.BankName,  MiniEmp.Royalty, MiniEmp.NeedDeposit, MiniEmp.Deposit AS TemDeposit ");
            strSql.Append(" ,Pay.Add1, Pay.Add2, Pay.Add3, Pay.Add4, Pay.Add5, Pay.Jian1, Pay.Jian2, Pay.Jian3, Pay.Jian4, Pay.Jian5, Pay.ActualMonth,Pay.NotFact ");
            strSql.Append(" FROM      Pay INNER JOIN MiniEmp ON Pay.EmployeeID = MiniEmp.ID WHERE   (Pay.MainID = @MainID)");
            SqlParameter[] sp = { new SqlParameter("MainID", MainID) };

            ds = DbHelperSQL.Query(strSql.ToString(), sp);
            ds.Tables[0].TableName = "Main";
            // ds.Tables[0].Columns.Add("SumAmount", typeof(int));
            strSql.Remove(0, strSql.Length);
            //strSql.Append("select (select Employeename from employee where (employeeid=paysum.employeeid)) as EmployeeName ,(select Materielname from materiel where (materielid=paysum.MaterielID)) as MaterielName, ");
            //strSql.Append(" (select workingname from working where (workingid=paysum.WorkingID)) as WorkingName,MaterielID,WorkingID, ");
            //strSql.Append(" Amount,Price,Amount*Price as Money, EmployeeID ");
            //strSql.Append(" FROM PaySum where (PayMainID=@MainID)");
            strSql.Append("SELECT   MaterielID, WorkingID, Amount, Price,  Amount * Price AS Money, EmployeeID ");
            strSql.Append(" FROM      PaySum WHERE   (PayMainID = @MainID)");

            SqlParameter[] sp1 = { new SqlParameter("MainID", MainID) };
            dsInfo = DbHelperSQL.Query(strSql.ToString(), sp1);
            dsInfo.Tables[0].TableName = "Info";
            //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            //{
            //    int employeeid = int.Parse(ds.Tables[0].Rows[i]["EmployeeID"].ToString());
            //    int amount = 0;
            //    for (int j = 0; j < dsInfo.Tables[0].Rows.Count; j++)
            //    {
            //        if (int.Parse(dsInfo.Tables[0].Rows[j]["EmployeeID"].ToString()) == employeeid)
            //        {
            //            amount += int.Parse(dsInfo.Tables[0].Rows[j]["Amount"].ToString());
            //        }
            //    }
            //    ds.Tables[0].Rows[i]["SumAmount"] = amount;
            //}
            ds.Tables.Add(dsInfo.Tables[0].Copy());
            dsInfo.Clear();
            strSql.Remove(0, strSql.Length);
            Hownet.DAL.SysTem   dalST       = new SysTem();
            Hownet.Model.SysTem modST       = dalST.GetModel(dalST.GetMaxId() - 1);
            DataTable           dtNoDefault = new DataTable();

            if (modST.DoubleNotDefaultWTNum > 0)
            {
                strSql.Append("SELECT   PaySum.MaterielID, PaySum.WorkingID, PaySum.Amount, PaySum.Price, PaySum.Amount * PaySum.Price AS Money, ");
                strSql.Append(" PaySum.EmployeeID FROM      PaySum INNER JOIN MiniEmp AS MiniEmp_1 ON PaySum.EmployeeID = MiniEmp_1.ID INNER JOIN ");
                strSql.Append(" Working ON PaySum.WorkingID = Working.ID WHERE   (PaySum.PayMainID = @MainID) AND (',' + MiniEmp_1.DefaultWorkType ");
                strSql.Append(" + ',' NOT LIKE '%,' + CAST(Working.WorkTypeID AS nvarchar) + ',%') AND (PaySum.MaterielID > 0) ");
                dtNoDefault = DbHelperSQL.Query(strSql.ToString(), sp1).Tables[0];
            }
            else
            {
                strSql.Append("SELECT   PaySum.MaterielID, PaySum.WorkingID, PaySum.Amount, PaySum.Price, PaySum.Amount * PaySum.Price AS Money, ");
                strSql.Append(" PaySum.EmployeeID FROM      PaySum Where (ID=0)");
                dtNoDefault = DbHelperSQL.Query(strSql.ToString(), sp1).Tables[0];
            }
            dtNoDefault.TableName = "NoDefault";
            ds.Tables.Add(dtNoDefault.Copy());
            dtNoDefault.Clear();
            try
            {
                ds.Relations.Add("明细", ds.Tables["Main"].Columns["EmployeeID"], ds.Tables["Info"].Columns["EmployeeID"]);
            }
            catch
            {
            }
            try
            {
                ds.Relations.Add("非默认工种", ds.Tables["Main"].Columns["EmployeeID"], ds.Tables["NoDefault"].Columns["EmployeeID"]);
            }
            catch (Exception ex)
            {
            }
            return(ds);
        }
Ejemplo n.º 9
0
        private void frCompanyInfo_Load(object sender, EventArgs e)
        {
            dtOT = bllOT.GetList("(TypeID=" + (int)Hownet.BLL.Enums.OtherType.系统设置 + ")").Tables[0];
            DataRow[] drs = dtOT.Select("(Name='物料使用条码出入仓')");
            if (drs.Length == 0)
            {
                DataTable dtTem = dtOT.Clone();
                DataRow   dr    = dtTem.NewRow();
                dr["A"]      = 1;
                dr["ID"]     = 0;
                dr["Name"]   = "物料使用条码出入仓";
                dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置;
                dr["Value"]  = "False";
                dtTem.Rows.Add(dr);
                bllOT.AddByDt(dtTem);
            }
            else
            {
                try
                {
                    _chb物料使用条码出入仓.Checked = Convert.ToBoolean(drs[0]["Value"]);
                }
                catch (Exception ex)
                {
                }
            }

            drs = dtOT.Select("(Name='成品需按货架存放')");
            if (drs.Length == 0)
            {
                DataTable dtTem = dtOT.Clone();
                DataRow   dr    = dtTem.NewRow();
                dr["A"]      = 1;
                dr["ID"]     = 0;
                dr["Name"]   = "成品需按货架存放";
                dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置;
                dr["Value"]  = "False";
                dtTem.Rows.Add(dr);
                bllOT.AddByDt(dtTem);
            }
            else
            {
                try
                {
                    _chb成品需按货架存放.Checked = Convert.ToBoolean(drs[0]["Value"]);
                }
                catch (Exception ex)
                {
                }
            }
            drs = dtOT.Select("(Name='分组显示为部位')");
            if (drs.Length == 0)
            {
                DataTable dtTem = dtOT.Clone();
                DataRow   dr    = dtTem.NewRow();
                dr["A"]      = 1;
                dr["ID"]     = 0;
                dr["Name"]   = "分组显示为部位";
                dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置;
                dr["Value"]  = "False";
                dtTem.Rows.Add(dr);
                bllOT.AddByDt(dtTem);
            }
            else
            {
                try
                {
                    _chb分组显示为部位.Checked = Convert.ToBoolean(drs[0]["Value"]);
                }
                catch (Exception ex)
                {
                }
            }
            drs = dtOT.Select("(Name='备份文件夹位置')");
            if (drs.Length == 0)
            {
                DataTable dtTem = dtOT.Clone();
                DataRow   dr    = dtTem.NewRow();
                dr["A"]      = 1;
                dr["ID"]     = 0;
                dr["Name"]   = "备份文件夹位置";
                dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置;
                dr["Value"]  = @"E:\Backup";
                dtTem.Rows.Add(dr);
                bllOT.AddByDt(dtTem);
            }
            else
            {
                try
                {
                    _teBackUpDir.Text = drs[0]["Value"].ToString();
                }
                catch (Exception ex)
                {
                }
            }
            int _id = bllST.GetMaxId() - 1;

            //  ds = bllST.GetList("(ID=" + _id + ")");
            modST = bllST.GetModel(_id);
            Hownet.BLL.Working   bllW = new Hownet.BLL.Working();
            Hownet.BLL.Deparment bllD = new Hownet.BLL.Deparment();
            _coBackDepot.DataSource = bllW.GetList("(IsSpecial=0)").Tables[0];
            DataTable dtD = bllD.GetList("(TypeID=42)").Tables[0];

            _coDefaultRaw.DataSource = dtD;
            DataTable dtDD = bllD.GetList("(TypeID=42) OR (TypeID=39)").Tables[0];

            //DataRow dr = dtDD.NewRow();
            //dr["ID"] = 0;
            //dr["Name"] = string.Empty;
            //dtDD.Rows.Add(dr);
            _coDefaultDepot.DataSource = dtDD;
            if (modST != null)
            {
                ID                             = modST.ID;
                _address.Text                  = modST.Address;
                _bank.Text                     = modST.BanKName;
                _bankID.Text                   = modST.BankNO;
                _bankUser.Text                 = modST.BankUserName;
                _comName.Text                  = modST.CompanyName;
                _fax.Text                      = modST.Fax;
                _linkMan.Text                  = modST.LinkMan;
                _phone.Text                    = modST.Phone;
                _ceDirect.Checked              = modST.Direct2Depot;
                _ceSell.Checked                = modST.Sell4Depot;
                _ceAutoClient.Checked          = modST.AutoClient;
                _chBoxOrPic.Checked            = modST.BoxOrPic;
                _Mobile.Text                   = modST.Mobile;
                _coNumType.SelectedIndex       = modST.NumType;
                _coSellMoney.SelectedIndex     = modST.SellMoney;
                _ceCustom.Checked              = modST.CustOder;
                _chNotPermissions.Checked      = modST.NotPermissions;
                _ceDepotAllowNegative.Checked  = modST.DepotAllowNegative;
                _ceIsChangedSales.Checked      = modST.IsChangedSales;
                _coBackDepot.SelectedValue     = modST.BackDepotWorking;
                _mbOderOne.Text                = modST.OderOne.ToString().PadLeft(2, '0');
                _mbOderTwo.Text                = modST.OderTwo.ToString().PadLeft(2, '0');
                _mbOrderThree.Text             = modST.OderThree.ToString().PadLeft(2, '0');
                _ceAutoCaicBoardWages.Checked  = modST.AutoCaicBoardWages;
                _coDefaultRaw.SelectedValue    = modST.DefaultRawDepot;
                _coDefaultDepot.SelectedValue  = modST.DefaultDepot;
                _ceIsShowMoney.Checked         = modST.IsShowMoney;
                _ceCompanyByUser.Checked       = modST.CompanyByUser;
                _teDoubleNotDefaultWTNum.Text  = modST.DoubleNotDefaultWTNum.ToString();
                _meOrderDays.Text              = modST.OrderDays.ToString();
                _ceOrderNeedEat.Checked        = modST.OrderNeedEat;
                _ceIsCheckNoWork.Checked       = modST.IsCheckNoWork;
                _ceIsCanEditAmount.Checked     = modST.IsCanEditAmount;
                _ceIsAutoClose.Checked         = modST.IsAutoClose;
                _ceIsTicketNotNeedCaic.Checked = modST.IsTicketNotNeedCaic;
                _ceIsShowOutEmp.Checked        = modST.IsShowOutEmp;
                _chMaterielByTask.Checked      = modST.MaterielByTask;
                _chMaterielByTask.Enabled      = bllST.CheckCanSetMatByTask();
                _ceSumByWorking.Checked        = modST.SumByWorking;
                _tbRegistration.Text           = modST.Registration;
            }
            else
            {
                modST = new Hownet.Model.SysTem();
                _coDefaultRaw.SelectedValue   = _coDefaultDepot.SelectedValue = 0;
                _teDoubleNotDefaultWTNum.Text = "0";
            }
        }