コード例 #1
0
        public string UpWorkEmp(int MainID, string WorkingName, int EmpID)
        {
            string aaa = string.Empty;

            Hownet.BLL.Working bllW = new Working();

            DataTable dtW = bllW.GetList("(Name='" + WorkingName + "')").Tables[0];

            if (dtW.Rows.Count > 0)
            {
                DataTable dt = dal.GetList("(MainID=" + MainID + ") And (WorkingID=" + dtW.Rows[0]["ID"] + ")").Tables[0];
                if (dt.Rows.Count == 1)
                {
                    Hownet.Model.WorkTicketInfo modWTI = GetModel(Convert.ToInt32(dt.Rows[0]["ID"]));
                    modWTI.EmployeeID = EmpID;
                    modWTI.DateTime   = DateTime.Now;
                    Update(modWTI);

                    Hownet.BLL.WorkTicket      bllWT  = new WorkTicket();
                    Hownet.BLL.ProductTaskMain bllPTM = new ProductTaskMain();

                    Hownet.Model.WorkTicket      modWT  = bllWT.GetModel(modWTI.MainID);
                    Hownet.Model.ProductTaskMain modPTM = bllPTM.GetModel(modWT.TaskID);
                    Hownet.BLL.PayInfo           bllPI  = new PayInfo();
                    Hownet.Model.PayInfo         modPI  = new Hownet.Model.PayInfo();
                    modPI.A                = 3;
                    modPI.Amount           = modWTI.Amount;
                    modPI.BoxNum           = modWT.BoxNum;
                    modPI.BreakID          = 1;
                    modPI.ColorID          = modWT.ColorID;
                    modPI.DateTime         = DateTime.Now;
                    modPI.EmployeeID       = EmpID;
                    modPI.ID               = 0;
                    modPI.IsDay            = false;
                    modPI.IsSum            = false;
                    modPI.MaterielID       = modPTM.MaterielID;
                    modPI.OderNum          = modPTM.DateTime.ToString("yyyyMMdd") + modPTM.Num.ToString().PadLeft(3, '0');
                    modPI.Price            = 0;
                    modPI.ProductWorkingID = modWTI.PWorkingInfoID;
                    modPI.SizeID           = modWT.SizeID;
                    modPI.WorkingID        = modWTI.WorkingID;
                    modPI.WorkticketInfoID = modWTI.ID;
                    bllPI.Add(modPI);
                    aaa = DateTime.Now.ToString();
                }
            }
            return(aaa);
        }
コード例 #2
0
        public void Save(DataTable dt, int mainID, int EmployeeID, DateTime date)
        {
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.HandBackInfo model;
                Hownet.BLL.PayInfo        bllPI = new PayInfo();
                Hownet.Model.PayInfo      modPI = new Hownet.Model.PayInfo();
                for (int n = 0; n < rowsCount; n++)
                {
                    if (dt.Rows[n].RowState != DataRowState.Deleted)
                    {
                        string a = dt.Rows[n]["A"].ToString();
                        if (a != "1")
                        {
                            model = new Hownet.Model.HandBackInfo();
                            if (dt.Rows[n]["MaterielID"].ToString() != "")
                            {
                                modPI.MaterielID = model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                            }
                            if (dt.Rows[n]["WorkingID"].ToString() != "")
                            {
                                modPI.WorkingID = model.WorkingID = int.Parse(dt.Rows[n]["WorkingID"].ToString());
                            }
                            if (dt.Rows[n]["Amount"].ToString() != "")
                            {
                                modPI.Amount = model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString());
                            }
                            if (dt.Rows[n]["Price"].ToString() != "")
                            {
                                modPI.Price = model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                            }
                            if (dt.Rows[n]["Money"].ToString() != "")
                            {
                                model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString());
                            }
                            if (dt.Rows[n]["PriceID"].ToString() != "")
                            {
                                modPI.ProductWorkingID = model.PriceID = int.Parse(dt.Rows[n]["PriceID"].ToString());
                            }
                            modPI.BoxNum     = model.InfoID = int.Parse(dt.Rows[n]["InfoID"].ToString());
                            modPI.EmployeeID = EmployeeID;
                            modPI.DateTime   = date;
                            model.MainID     = mainID;
                            modPI.ColorID    = modPI.SizeID = 0;
                            modPI.OderNum    = "";
                            modPI.IsSum      = false;

                            if (model.MaterielID != 0 && model.WorkingID != 0 && model.Amount != 0)
                            {
                                if (a == "3")
                                {
                                    modPI.BoxNum = Add(model);
                                    bllPI.Add(modPI);
                                }
                                else if (a == "2")
                                {
                                    modPI.ID = int.Parse(dt.Rows[n]["PayInfoID"].ToString());
                                    Update(model);
                                    bllPI.Update(modPI);
                                }
                            }
                        }
                    }
                }
            }
        }