コード例 #1
0
        protected void rpSupplier_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Add")
            {
                if (e.Item.ItemType == ListItemType.Header)
                {
                    TextBox txtSupplierNameAdd = e.Item.FindControl("txtSupplierNameAdd") as TextBox;
                    TextBox txtContactNameAdd  = e.Item.FindControl("txtContactNameAdd") as TextBox;
                    TextBox txtPhoneAdd        = e.Item.FindControl("txtPhoneAdd") as TextBox;
                    TextBox txtRemarkAdd       = e.Item.FindControl("txtRemarkAdd") as TextBox;

                    SupplierDAL dal = new SupplierDAL();
                    Supplier    s   = new Supplier()
                    {
                        Supplier_Name        = txtSupplierNameAdd.Text,
                        Supplier_ContactName = txtContactNameAdd.Text,
                        Supplier_Phone       = txtPhoneAdd.Text,
                        Remark = txtRemarkAdd.Text
                    };
                    dal.AddSupplier(s);
                }
            }
            if (e.CommandName == "Delete")
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    HiddenField hfId = e.Item.FindControl("hfId") as HiddenField;
                    SupplierDAL dal  = new SupplierDAL();
                    dal.DeleteSupplier(int.Parse(hfId.Value));
                }
            }
            if (e.CommandName == "Save")
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    TextBox     txtSupplierName = e.Item.FindControl("txtSupplierName") as TextBox;
                    TextBox     txtContactName  = e.Item.FindControl("txtContactName") as TextBox;
                    TextBox     txtPhone        = e.Item.FindControl("txtPhone") as TextBox;
                    TextBox     txtRemark       = e.Item.FindControl("txtRemark") as TextBox;
                    HiddenField hfId            = e.Item.FindControl("hfId") as HiddenField;
                    SupplierDAL dal             = new SupplierDAL();
                    var         supplier        = dal.GetSupplierById(int.Parse(hfId.Value));
                    supplier.Supplier_Name        = txtSupplierName.Text;
                    supplier.Supplier_ContactName = txtContactName.Text;
                    supplier.Supplier_Phone       = txtPhone.Text;
                    supplier.Remark = txtRemark.Text;
                    dal.Save();
                }
            }
            BindRepeater();
        }
コード例 #2
0
        public static List <NameValueItem> GetSupplierNameList()
        {
            SupplierDAL dal       = new SupplierDAL();
            var         suppliers = dal.GetSupplierList();
            var         result    = from s in suppliers
                                    orderby s.Supplier_Name
                                    select new NameValueItem()
            {
                Name  = s.Supplier_Name,
                Value = s.Supplier_Name
            };

            return(result.ToList());
        }
コード例 #3
0
        // GET: Admin/Suppliers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var supplier = new SupplierDAL().ViewDetail(id);

            if (supplier == null)
            {
                return(HttpNotFound());
            }
            return(View(supplier));
        }
コード例 #4
0
ファイル: SupplierBL.cs プロジェクト: Pulakeshin/mediocre
        public static Supplier SearchSupplierBL(int searchSupplierID)
        {
            Supplier searchSupplier = null;

            try
            {
                SupplierDAL guestDAL = new SupplierDAL();
                searchSupplier = guestDAL.SearchSupplierDAL(searchSupplierID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchSupplier);
        }
コード例 #5
0
        //creating a method to search for all valid suppliers by their respective ID
        public Supplier SearchSupplierBL(string searchSupplierID)
        {
            Supplier searchSupplier = null;

            try
            {
                SupplierDAL supplierDAL = new SupplierDAL();
                searchSupplier = supplierDAL.SearchSupplierDAL(searchSupplierID);
            }
            catch (Exception ex)
            {
                throw new InventoryException(ex.Message);
            }

            return(searchSupplier);
        }
コード例 #6
0
ファイル: SupplierBL.cs プロジェクト: Pulakeshin/mediocre
        public static List <Supplier> GetAllSupplierBL()
        {
            List <Supplier> SupplierList = null;

            try
            {
                SupplierDAL supplierDAL = new SupplierDAL();
                SupplierList = supplierDAL.GetAllSupplierDAL();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(SupplierList);
        }
コード例 #7
0
        // get list of All valid suppliers
        public List <Supplier> GetAllSuppliersBL()
        {
            List <Supplier> supplierList = null;

            try
            {
                SupplierDAL supplierDAL = new SupplierDAL();
                supplierList = supplierDAL.GetAllSuppliersDAL();
            }
            catch (Exception ex)
            {
                throw new InventoryException(ex.Message);
            }

            return(supplierList);
        }
コード例 #8
0
 static public bool Destory(List <int> list, out string msg)
 {
     if (list == null || list.Count == 0)
     {
         msg = "没有记录需要销毁";
         return(false);
     }
     for (int i = 0; i < list.Count; i++)
     {
         if (!SupplierDAL.Delete(list[i], out msg))
         {
             return(false);
         }
     }
     msg = "";
     return(true);
 }
コード例 #9
0
ファイル: FrmAllGoods.cs プロジェクト: honstat/mvctest
        private void initdata()
        {
            int total = 0;

            List <Dic> dicslist = DicDAL.Getlist("", 0, out total);

            if (dicslist.Count > 0)
            {
                diclist = dicslist.ToDictionary(x => x.KeyId);
            }
            List <Supplier> suplist = SupplierDAL.Getlist("", 4, out total);

            if (suplist != null && suplist.Count > 0)
            {
                suplierIdlist = suplist.ToDictionary(x => x.SupplierId);
            }
        }
コード例 #10
0
        //creating a method to add validted supplier
        public bool AddSupplierBL(Supplier newSupplier)
        {
            bool supplierAdded = false;

            try
            {
                if (ValidateSupplier(newSupplier))
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    supplierAdded = supplierDAL.AddSupplierDAL(newSupplier);
                }
            }
            catch (Exception ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(supplierAdded);
        }
コード例 #11
0
ファイル: SupplierBL.cs プロジェクト: Pulakeshin/mediocre
        public static bool UpdateSupplierBL(Supplier updateSupplier)
        {
            bool SupplierUpdated = false;

            try
            {
                if (ValidateSupplier(updateSupplier))
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    SupplierUpdated = supplierDAL.UpdateSupplierDAL(updateSupplier);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(SupplierUpdated);
        }
コード例 #12
0
ファイル: supplierBL.cs プロジェクト: pushpraj789/capg-lab
        public static List <Supplier> GetAllSuppliersBL()
        {
            List <Supplier> guestList = null;

            try
            {
                SupplierDAL supplierDAL = new SupplierDAL();
                supplierList = supplierDAL.GetAllSuppliersDAL();
            }
            catch (Inventory ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(supplierList);
        }
コード例 #13
0
ファイル: SupplierBL.cs プロジェクト: Pulakeshin/mediocre
        public static bool AddSupplierBL(Supplier newSupplier)
        {
            bool SupplierAdded = false;

            try
            {
                if (ValidateSupplier(newSupplier))
                {
                    SupplierDAL SupplierDAL = new SupplierDAL();
                    SupplierAdded = SupplierDAL.AddSupplierDAL(newSupplier);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(SupplierAdded);
        }
コード例 #14
0
ファイル: supplierBL.cs プロジェクト: pushpraj789/capg-lab
        public static Supplier SearchSupplierBL(int searchSupplierID)
        {
            Guest searchGuest = null;

            try
            {
                SupplierDAL supplierDAL = new SupplierDAL();
                searchSupplier = supplierDAL.SearchSupplierDAL(searchSupplierID);
            }
            catch (Inventory ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchSupplier);
        }
コード例 #15
0
        public ActionResult delupsup(string countryName)
        {
            string connectionString = ConfigurationManager
                                      .ConnectionStrings["LiteCommerceDB"]
                                      .ConnectionString;
            ISupplierDAL dal = new SupplierDAL(connectionString);
            Supplier     s   = new Supplier()
            {
                SupplierName = "Ton That Pho",
                ContactName  = "hahahaha",
                Address      = "t2",
                City         = "trong",
                PostalCode   = "t4",
                Country      = "t5",
                Phone        = "t6"
            };
            var data = dal.Update(30, s);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #16
0
ファイル: SupplierTest.cs プロジェクト: wenfeifei/WinForm-
        public void DeleteTest()
        {
            Supplier s = new Supplier();

            s.SupplierID = "123";
            SupplierDAL target = new SupplierDAL();

            bool atual    = target.Delete(s);        //实际的结果
            bool expected = true;                    //预期的结果

            Assert.AreEqual(expected, atual);        //断言判等


            //测试无效的
            s.SupplierID = "123";

            atual    = target.Delete(s);          //实际的结果
            expected = false;                     //预期的结果

            Assert.AreEqual(expected, atual);     //断言判等
        }
コード例 #17
0
        public void GetALLTest()
        {
            SupplierDAL     dal  = new SupplierDAL();
            List <Supplier> list = dal.GetALL();

            Assert.AreEqual(2, list.Count);

            Supplier s = list[0];

            Assert.AreEqual("12", s.SupplierID);
            Assert.AreEqual("1", s.SupplierName);
            Assert.AreEqual("1", s.SpellingCode);
            Assert.AreEqual("1", s.Address);
            Assert.AreEqual("1", s.ZipCode.ToString().Trim());
            Assert.AreEqual("1", s.Tel);
            Assert.AreEqual("1", s.Fax);
            Assert.AreEqual("1", s.BankName);
            Assert.AreEqual("1", s.BankAccount);
            Assert.AreEqual("1", s.Contacter);
            Assert.AreEqual("1", s.Email);
        }
コード例 #18
0
        public void FindByIDTest()
        {
            SupplierDAL dal = new SupplierDAL();

            Assert.IsNull(dal.FindByID("10"));

            Supplier s = dal.FindByID("12");

            Assert.IsNotNull(s);
            Assert.AreEqual("12", s.SupplierID);
            Assert.AreEqual("1", s.SupplierName);
            Assert.AreEqual("1", s.SpellingCode);
            Assert.AreEqual("1", s.Address);
            Assert.AreEqual("1", s.ZipCode.ToString().Trim());
            Assert.AreEqual("1", s.Tel);
            Assert.AreEqual("1", s.Fax);
            Assert.AreEqual("1", s.BankName);
            Assert.AreEqual("1", s.BankAccount);
            Assert.AreEqual("1", s.Contacter);
            Assert.AreEqual("1", s.Email);
        }
コード例 #19
0
        public List <State> AutoFillState()
        {
            int autoId = 1;

            List <State>  stateList;
            ISupplierDAL  supplierDAL = new SupplierDAL();
            List <string> strlist     = supplierDAL.GetAutoFillData("state");

            stateList = new List <State>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    State lst = new State();
                    lst.StateID = autoId;
                    lst.Name    = name;
                    stateList.Add(lst);
                    autoId++;
                }
            }
            return(stateList);
        }
コード例 #20
0
        public List <PostalCode> AutoFillPostalCode()
        {
            int autoId = 1;

            List <PostalCode> postalcodeList;
            ISupplierDAL      supplierDAL = new SupplierDAL();
            List <string>     strlist     = supplierDAL.GetAutoFillData("postalcode");

            postalcodeList = new List <PostalCode>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    PostalCode lst = new PostalCode();
                    lst.PostalCodeID = autoId;
                    lst.Name         = name;
                    postalcodeList.Add(lst);
                    autoId++;
                }
            }
            return(postalcodeList);
        }
コード例 #21
0
        public ActionResult Edit([Bind(Include = "SupplierID,SupplierName,MetaTitle,EmailSupport,PhoneNumber,Detail,CreateDate,CreateUser,ModifiedDate,ModifiedUser,IsActive")] Supplier supplier)
        {
            var UserSession = (UserLogin)Session[TechDeviShopVs002.Common.CommonConstants.USER_SESSION];

            if (ModelState.IsValid)
            {
                var _dal = new SupplierDAL();

                supplier.ModifiedUser = UserSession.UserID;

                var _result = _dal.Update(supplier);
                if (_result)
                {
                    return(RedirectToAction("Index", "Suppliers"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật Nhà cung cấp ko thành công");
                }
            }
            return(View(supplier));
        }
コード例 #22
0
        public List <City> AutoFillCity()
        {
            int autoId = 1;

            List <City>   cityList;
            ISupplierDAL  supplierDAL = new SupplierDAL();
            List <string> strlist     = supplierDAL.GetAutoFillData("city");

            cityList = new List <City>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    City lst = new City();
                    lst.CityID = autoId;
                    lst.Name   = name;
                    cityList.Add(lst);
                    autoId++;
                }
            }
            return(cityList);
        }
コード例 #23
0
        public void InsertTest()
        {
            SupplierDAL dal = new SupplierDAL();
            Supplier    s   = new Supplier("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1");

            Assert.IsTrue(dal.Insert(s));
            Supplier s2 = dal.FindByID("1");

            Assert.AreEqual("1", s2.SupplierID);
            Assert.AreEqual("1", s2.SupplierName);
            Assert.AreEqual("1", s2.SpellingCode);
            Assert.AreEqual("1", s2.Address);
            Assert.AreEqual("1", s2.ZipCode.ToString().Trim());
            Assert.AreEqual("1", s2.Tel);
            Assert.AreEqual("1", s2.Fax);
            Assert.AreEqual("1", s2.BankName);
            Assert.AreEqual("1", s2.BankAccount);
            Assert.AreEqual("1", s2.Contacter);
            Assert.AreEqual("1", s2.Email);

            s2 = new Supplier("12", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1");
            Assert.IsFalse(dal.Insert(s2));
        }
コード例 #24
0
ファイル: supplierBL.cs プロジェクト: pushpraj789/capg-lab
        public static bool AddSupplierBL(Supplier newSupplier)
        {
            bool supplierAdded = false;

            try
            {
                if (ValidateSupplier(newSupplier))
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    supplierAdded = supplierDAL.AddGuestDAL(newSupplier);
                }
            }
            catch (InventoryException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(supplierAdded);
        }
コード例 #25
0
ファイル: supplierBL.cs プロジェクト: pushpraj789/capg-lab
        public static bool UpdateSupplierBL(Supplier updateSupplier)
        {
            bool supplierUpdated = false;

            try
            {
                if (ValidateSupplier(updateSupplier))
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    guestUpdated = supplierDAL.UpdateSupplierDAL(updateSupplier);
                }
            }
            catch (InventoryException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(supplierUpdated);
        }
コード例 #26
0
ファイル: SupplierTest.cs プロジェクト: wenfeifei/WinForm-
        public void UpdataTest()
        {
            Supplier s = new Supplier();

            s.SupplierID                   = "123";
            s.SupplierContact.Name         = "这是供应商名字";
            s.SupplierContact.SpellingCode = "GYSMZ";
            s.SupplierContact.Address      = "广西柳州";
            s.SupplierContact.ZipCode      = "1546546";
            s.SupplierContact.Tel          = "88888888";
            s.SupplierContact.Fax          = "88888888";
            s.SupplierContact.BankName     = "我的瑞士银行";
            s.SupplierContact.BankAccount  = "8888888888888888888888888";
            s.SupplierContact.Contacter    = "默";
            s.SupplierContact.Email        = "*****@*****.**";

            SupplierDAL target = new SupplierDAL();

            bool atual    = target.Update(s);        //实际的结果
            bool expected = true;                    //预期的结果

            Assert.AreEqual(expected, atual);        //断言判等
        }
コード例 #27
0
ファイル: SupplierBL.cs プロジェクト: Pulakeshin/mediocre
        public static bool DeleteSupplierBL(string deleteSupplierID)
        {
            bool SupplierDeleted = false;

            try
            {
                if (deleteSupplierID == null)
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    SupplierDeleted = supplierDAL.DeleteSupplierDAL(int.Parse(deleteSupplierID));
                }
                else
                {
                    throw new Exception("Invalid supplier ID");
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(SupplierDeleted);
        }
コード例 #28
0
        //creating a method to delete the existing valid suppliers
        public bool DeleteSupplierBL(string deleteSupplierID)
        {
            bool supplierDeleted = false;

            try
            {
                if (deleteSupplierID == string.Empty)
                {
                    SupplierDAL supplierDAL = new SupplierDAL();
                    supplierDeleted = supplierDAL.DeleteSupplierDAL(deleteSupplierID);
                }
                else
                {
                    throw new InventoryException("Invalid Supplier ID");
                }
            }
            catch (Exception ex)
            {
                throw new InventoryException(ex.Message);
            }


            return(supplierDeleted);
        }
コード例 #29
0
ファイル: FrmSupplierManage.cs プロジェクト: honstat/mvctest
        private void binddata()
        {
            tv.Nodes.Clear();

            tv.ImageList = this.imglist;
            System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("供应商名称", 0, 1);

            int             total = 0;
            List <Supplier> list  = SupplierDAL.Getlist("", 0, out total);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TN.Nodes.Add("", item.Name.ToString(), 0, 1);
                }
            }



            tv.Nodes.Add(TN);

            tv.ExpandAll();
        }
コード例 #30
0
ファイル: Service1.svc.cs プロジェクト: AAGJKPRT/Services
        public LabourDetails InsertLabour(string FullName, string FatherName, string CurrentAddress, string CurrentStateID, string CurrentCityID, string CurrentPincode, string PermanentAddress, string PermanentStateID, string PermanentCityID, string PermanentPincode, string PhoneNo, string SectorType, string LabourType, string Specialization, string Experience, string Wages, string Lbr_Skill, string Bool_Verification, string SupplierID, string Belonging1, string Belonging2, string Belonging3, string Belonging4)
        {
            LabourDetails labourDetails = new LabourDetails();
            Labour labour = new Labour();
            SupplierDAL supplierDAL = new SupplierDAL();
            System.Net.WebHeaderCollection webHeaderCollection = WebOperationContext.Current.IncomingRequest.Headers;
            try
            {
                #region Url Decoding...
                FullName = HttpUtility.UrlDecode(FullName);
                FatherName = HttpUtility.UrlDecode(FatherName);
                CurrentAddress = HttpUtility.UrlDecode(CurrentAddress);
                CurrentStateID = HttpUtility.UrlDecode(CurrentStateID);
                CurrentCityID = HttpUtility.UrlDecode(CurrentCityID);
                CurrentPincode = HttpUtility.UrlDecode(CurrentPincode);
                PermanentAddress = HttpUtility.UrlDecode(PermanentAddress);
                PermanentStateID = HttpUtility.UrlDecode(PermanentStateID);
                PermanentCityID = HttpUtility.UrlDecode(PermanentCityID);
                PermanentPincode = HttpUtility.UrlDecode(PermanentPincode);
                PhoneNo = HttpUtility.UrlDecode(PhoneNo);
                SectorType = HttpUtility.UrlDecode(SectorType);
                LabourType = HttpUtility.UrlDecode(LabourType);
                Specialization = HttpUtility.UrlDecode(Specialization);
                Experience = HttpUtility.UrlDecode(Experience);
                Wages = HttpUtility.UrlDecode(Wages);
                Lbr_Skill = HttpUtility.UrlDecode(Lbr_Skill);
                Bool_Verification = HttpUtility.UrlDecode(Bool_Verification);
                SupplierID = HttpUtility.UrlDecode(SupplierID);
                Belonging1 = HttpUtility.UrlDecode(Belonging1);
                Belonging2 = HttpUtility.UrlDecode(Belonging2);
                Belonging3 = HttpUtility.UrlDecode(Belonging3);
                Belonging4 = HttpUtility.UrlDecode(Belonging4);
                #endregion

                #region Labour Code Generate
                string Sector = "";
                string LabourTypeCurrentCityPreFix = supplierDAL.GetLabourTypeCityPreFixCode(LabourType, CurrentCityID);
                //string CurrentCityPreFix = "";

                string CodePostFix = SupplierDAL.GenerateCodeWithLeftPad("tbl_LabourRegistration", "Reg_ID", 6, "", false);
                if (SectorType == "1")
                    Sector = "HH";
                else if (SectorType == "2")
                    Sector = "GL";
                else
                    Sector = "IL";
                string CodePrefix = Sector + LabourTypeCurrentCityPreFix + CurrentPincode.Substring(4, 2);
                string LabourCode = CodePrefix + CodePostFix;
                #endregion

                labour.LabourCode = LabourCode.ToUpper() == "NULL" ? "" : LabourCode;
                labour.FullName = FullName.ToUpper() == "NULL" ? "" : FullName;
                labour.FatherName = FatherName.ToUpper() == "NULL" ? "" : FatherName;
                labour.CurrentAddress = CurrentAddress.ToUpper() == "NULL" ? "" : CurrentAddress;
                labour.CurrentStateID = CurrentStateID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentStateID); ;
                labour.CurrentCityID = CurrentCityID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentCityID); ;
                labour.CurrentPincode = CurrentPincode.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentPincode);
                labour.PermanentAddress = PermanentAddress.ToUpper() == "NULL" ? "" : PermanentAddress;
                labour.PermanentStateID = PermanentStateID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentStateID);
                labour.PermanentCityID = PermanentCityID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentCityID); ;
                labour.PermanentPincode = PermanentPincode.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentPincode);
                labour.PhoneNo = PhoneNo.ToUpper() == "NULL" ? "0" : PhoneNo;
                labour.SectorType = SectorType.ToUpper() == "NULL" ? "0" : SectorType;
                labour.LabourType = LabourType.ToUpper() == "NULL" ? "0" : LabourType;
                labour.Specialization = Specialization.ToUpper() == "NULL" ? "0" : Specialization;
                labour.Experience = Experience.ToUpper() == "NULL" ? 0 : Convert.ToInt32(Experience);
                labour.Wages = Wages.ToUpper() == "NULL" ? 0 : Convert.ToInt32(Wages);
                labour.Lbr_Skill = Lbr_Skill.ToUpper() == "NULL" ? "" : Lbr_Skill;
                labour.Verification = Bool_Verification.ToUpper() == "NULL" ? false : true;
                labour.SupplierID = SupplierID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(SupplierID);
                labour.Belonging1 = Belonging1.ToUpper() == "NULL" ? "0" : Belonging1;
                labour.Belonging2 = Belonging2.ToUpper() == "NULL" ? "0" : Belonging2;
                labour.Belonging3 = Belonging3.ToUpper() == "NULL" ? "0" : Belonging3;
                labour.Belonging4 = Belonging4.ToUpper() == "NULL" ? "0" : Belonging4;

                labour.Image_URL = webHeaderCollection["Image_URL"] == null ? "" : webHeaderCollection["Image_URL"].ToString();
                labour.Doc1_URL = webHeaderCollection["Doc1_URL"] == null ? "" : webHeaderCollection["Doc1_URL"].ToString();
                labour.Doc2_URL = webHeaderCollection["Doc2_URL"] == null ? "" : webHeaderCollection["Doc2_URL"].ToString();
                labour.Doc3_URL = webHeaderCollection["Doc3_URL"] == null ? "" : webHeaderCollection["Doc3_URL"].ToString();
                labour.Doc4_URL = webHeaderCollection["Doc4_URL"] == null ? "" : webHeaderCollection["Doc4_URL"].ToString();

                supplierDAL.InsertNewLabourData("INSERT", labour);
                labourDetails.Message = "Labour inserted successfully !";
                labourDetails.Status = true;
                return labourDetails;
            }
            catch (Exception exception)
            {
                Logger Err = new Logger();
                Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace);
                labourDetails.Message = "Error occured and logged please connect the Service Manager !";
                labourDetails.Status = false;
                return labourDetails;
            }
        }
コード例 #31
0
ファイル: Service1.svc.cs プロジェクト: AAGJKPRT/Services
        public LabourDetails GetLabourList()
        {
            LabourDetails labourDetails = new LabourDetails();
            Labour labour;
            SupplierDAL supplierDAL = new SupplierDAL();
            try
            {
                DataTable dt = supplierDAL.GetLaboursList();
                if (dt.Rows.Count > 0)
                {

                    foreach (DataRow dr in dt.Rows)
                    {
                        labour = new Labour();
                        labour.CurrentPincode = Convert.ToInt32(dr["CurrentPincode"] == null ? 0 : dr["CurrentPincode"]);
                        labour.Doc1_URL = dr["Doc1_URL"].ToString().TrimStart('.');
                        labour.Doc2_URL = dr["Doc2_URL"].ToString().TrimStart('.');
                        labour.Doc3_URL = dr["Doc3_URL"].ToString().TrimStart('.');
                        labour.Doc4_URL = dr["Doc4_URL"].ToString().TrimStart('.');
                        labour.Experience = Convert.ToInt32(dr["Experience"] == null ? 0 : dr["Experience"]);
                        labour.FullName = dr["FullName"].ToString();
                        labour.Image_URL = dr["Image_URL"].ToString().TrimStart('.');
                        labour.LabourCode = dr["LabourCode"].ToString();
                        labour.LabourID = Convert.ToInt32(dr["Experience"] == null ? 0 : dr["Experience"]);
                        labour.LabourType = dr["LabourType"].ToString();
                        labour.Lbr_Skill = dr["Lbr_Skill"].ToString();
                        labour.SectorType = dr["SectorType"].ToString();
                        labour.Specialization = dr["Specialization"].ToString();
                        labour.SupplierID = Convert.ToInt32(dr["SupplierID"] == null ? 0 : dr["SupplierID"]);
                        labour.SupplierName = dr["SupplierName"].ToString();
                        string Verification = dr["Verification"] == null ? "0" : dr["Verification"].ToString();
                        labour.Verification = Verification == "1" ? true : false;
                        labour.Wages = Convert.ToInt32(dr["Wages"] == null ? 0 : dr["Wages"]);
                        labourDetails.Data.Add(labour);
                    }
                    labourDetails.ApplicationUrl = ConfigurationManager.AppSettings["ApplicationUrl"].ToString();//"http://dev.easylabour.com";
                    labourDetails.Count = dt.Rows.Count;
                    labourDetails.Status = true;
                    labourDetails.Message = "List of Labours !";
                }
                else
                {
                    labourDetails.Status = false;
                    labourDetails.Message = "No Labour exists !";
                }
            }
            catch (Exception exception)
            {
                labourDetails.Status = false;
                labourDetails.Message = "Opps something went worng, please check with application admin !";
                Logger Err = new Logger();
                Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace);
            }
            return labourDetails;
        }
コード例 #32
0
        /// <summary>
        /// InsertInfo
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public long InsertInfo(ReceiveDetailInfo info)
        {
            ReceiveInfo receiveInfo = new ReceiveDAL().GetInfo(info.ReceiveFid.GetValueOrDefault());

            if (receiveInfo == null)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            if (dal.GetList("[RECEIVE_FID] = N'" + info.ReceiveFid + "' and [PART_NO] = N'" + info.PartNo + "' and [SUPPLIER_NUM] = N'" + info.SupplierNum + "'", string.Empty).Count > 0)
            {
                throw new Exception("MC:0x00000464");///同物料号供应商不能一致
            }
            //if (receiveInfo.Status.GetValueOrDefault() != (int)WmmOrderStatusConstants.Created)
            //    throw new Exception("MC:0x00000152");///入库单处理已创建状态时才能添加材料

            int cnt = 0;
            ///入库单是否按供应商类型校验
            string receiveOrderValidSupplierTypeFlag = new ConfigDAL().GetValueByCode("RECEIVE_ORDER_VALID_SUPPLIER_TYPE_FLAG");

            if (receiveOrderValidSupplierTypeFlag.ToLower() == "true")
            {
                ///需要校验入库单的供应商是否为储运供应商
                cnt = new SupplierDAL().GetCounts("[SUPPLIER_TYPE] = " + (int)SupplierTypeConstants.LogisticsSupplier + " and [SUPPLIER_NUM] = N'" + receiveInfo.SupplierNum + "'");

                ///储运供应商标记
                bool logisticsSupplierFlag = cnt == 0 ? false : true;
                if (logisticsSupplierFlag)
                {
                    cnt = dal.GetCounts("[PART_NO] = N'" + info.PartNo + "' and [SUPPLIER_NUM] = N'" + info.SupplierNum + "' and [RECEIVE_FID] = N'" + info.ReceiveFid.GetValueOrDefault() + "'");
                    if (cnt > 0)
                    {
                        throw new Exception("MC:0x00000175");///同一入库单下不能出现相同供应商的物料编码
                    }
                }
                else
                {
                    ///入库单明细与入库单不是同一家供应商
                    cnt = new ReceiveDAL().GetCounts("[SUPPLIER_NUM] = N'" + info.SupplierNum + "' and [FID] = N'" + info.ReceiveFid.GetValueOrDefault() + "'");
                    if (cnt == 0)
                    {
                        throw new Exception("MC:0x00000176");///入库单的物料供应商与入库明细的供应商不一致
                    }
                    cnt = dal.GetCounts("[PART_NO] = N'" + info.PartNo + "' and [RECEIVE_FID] = N'" + info.ReceiveFid.GetValueOrDefault() + "'");
                    if (cnt > 0)
                    {
                        throw new Exception("MC:0x00000177");///同一入库单下不能出现相同的物料编码
                    }
                }
            }

            ///明细中供应商缺失时,从单据上获取
            if (string.IsNullOrEmpty(info.SupplierNum))
            {
                info.SupplierNum = receiveInfo.SupplierNum;
            }
            ///单据号
            if (string.IsNullOrEmpty(info.TranNo))
            {
                info.TranNo = receiveInfo.ReceiveNo;
            }
            ///拉动单号
            if (string.IsNullOrEmpty(info.RunsheetNo))
            {
                info.RunsheetNo = receiveInfo.RunsheetNo;
            }
            ///工厂
            if (string.IsNullOrEmpty(info.Plant))
            {
                info.Plant = receiveInfo.Plant;
            }
            ///仓库
            if (string.IsNullOrEmpty(info.TargetWm))
            {
                info.TargetWm = receiveInfo.WmNo;
            }
            ///存储区
            if (string.IsNullOrEmpty(info.TargetZone))
            {
                info.TargetZone = receiveInfo.ZoneNo;
            }

            ///来源
            ///仓库
            //if (string.IsNullOrEmpty(info.WmNo)) info.WmNo = receiveInfo.SourceWmNo;
            /////存储区
            //if (string.IsNullOrEmpty(info.ZoneNo)) info.ZoneNo = receiveInfo.SourceZoneNo;

            ///创建入库单时实收数量等于需求数量
            string createReceiveActualQtyEqualsRequired = new ConfigDAL().GetValueByCode("CREATE_RECEIVE_ACTUAL_QTY_EQUALS_REQUIRED");

            if (createReceiveActualQtyEqualsRequired.ToLower() == "true")
            {
                info.ActualBoxNum = info.RequiredBoxNum;
                info.ActualQty    = info.RequiredQty;
            }
            ///如果需求箱数大于零
            if (info.RequiredBoxNum.GetValueOrDefault() > 0)
            {
                ///如果未填写单包装毛重,但是填写了总毛重,需要计算
                if (info.PerpackageGrossWeight.GetValueOrDefault() == 0 && info.SumWeight.GetValueOrDefault() > 0)
                {
                    info.PerpackageGrossWeight = info.SumWeight.GetValueOrDefault() / info.RequiredBoxNum.GetValueOrDefault();
                }
                ///体积也是如此处理
                if (info.PackageVolume.GetValueOrDefault() == 0 && info.SumVolume.GetValueOrDefault() > 0)
                {
                    info.PackageVolume = info.SumVolume.GetValueOrDefault() / info.RequiredBoxNum.GetValueOrDefault();
                }
                ///件数也是如此处理
                if (info.Package.GetValueOrDefault() == 0 && info.RequiredQty.GetValueOrDefault() > 0)
                {
                    info.Package = Math.Ceiling(info.RequiredQty.GetValueOrDefault() / info.RequiredBoxNum.GetValueOrDefault());
                }
            }
            ///
            return(dal.Add(info));
        }