Exemplo n.º 1
0
        public async Task <IActionResult> Edit([Bind("VendorCode,VendorName,AddressL1,AddressL2,AddressL3,AddressL4,Telephone,Fax,VendorEmail,VendorContact,CreditTerm,PriceLevel,VendorTaxId,Remark,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Vendor m_Vendor)
        {
            if (ModelState.IsValid)
            {
                m_Vendor.Updated_By = await base.CurrentUserId();

                ResultObject resultObj;

                try
                {
                    using (var vendBll = new VendorBLL())
                    {
                        resultObj = await vendBll.UpdateVendor(m_Vendor);

                        _cache.Remove("CACHE_MASTER_VENDOR");
                    }

                    return(Json(new { success = true, data = (M_Vendor)resultObj.ObjectValue, message = "Vendor Update." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, data = m_Vendor, message = ex.Message }));
                }
            }

            var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList();

            return(Json(new { success = false, errors = err, data = m_Vendor, message = "Update Failed" }));
        }
Exemplo n.º 2
0
        // GET: Master/Vendor
        public async Task <IActionResult> GetVendor()
        {
            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_VENDOR", out List <M_Vendor> c_lstVend))
                {
                    return(Json(new { data = c_lstVend }));
                }

                MemoryCacheEntryOptions options = new MemoryCacheEntryOptions
                {
                    AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300),
                    SlidingExpiration = TimeSpan.FromSeconds(60),
                    Priority          = CacheItemPriority.NeverRemove
                };

                using (var vendBll = new VendorBLL())
                {
                    var lstVend = await vendBll.GetVendor(null);

                    _cache.Set("CACHE_MASTER_VENDOR", lstVend, options);

                    return(Json(new { data = lstVend }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }

            //using (var vendBll = new VendorBLL())
            //{
            //    return Json(new { data = await vendBll.GetVendor(null) });
            //}
        }
Exemplo n.º 3
0
        public async Task <IActionResult> UploadModelData(List <M_Vendor> lstVend)
        {
            var uId = await base.CurrentUserId();

            lstVend.ForEach(m =>
            {
                m.Created_By = uId;
            });

            try
            {
                using (var vendBll = new VendorBLL())
                {
                    var rowaffected = await vendBll.BulkInsertVendor(lstVend);

                    _cache.Remove("CACHE_MASTER_VENDOR");
                }

                return(Json(new { success = true, data = lstVend, message = "Import Success." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = true, data = lstVend, message = ex.Message }));
            }
        }
Exemplo n.º 4
0
        protected void btnCreateVendor_Click(object sender, EventArgs e)
        {
            try
            {
                Vendor obj = new Vendor();


                obj.SupName     = txtVendorName.Text;
                obj.Email       = txtEmail.Text;
                obj.city        = txtcity.Text;
                obj.State       = txtState.Text;
                obj.Country     = txtCounty.Text;
                obj.address     = txtaddress.Text;
                obj.ConPerson   = txtConPerson.Text;
                obj.Credit      = txtCredit.Text;
                obj.Discount    = txtDiscount.Text;
                obj.Fax         = txtfax.Text;
                obj.Phone       = txtphone.Text;
                obj.Mobile      = txtmobile.Text;
                obj.Pager       = txtpager.Text;
                obj.Pincode     = txtPincode.Text;
                obj.DateCreated = DateTime.Now;
                VendorBLL objAdd = new VendorBLL();
                objAdd.Add(obj, connection);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Clear();
            }
        }
Exemplo n.º 5
0
        private void LoadData()
        {
            try
            {
                DataSet ds  = new DataSet();
                Vendor  obj = new Vendor();

                obj.supp_ID = int.Parse(Request.QueryString["Id"].ToString());
                ds          = VendorBLL.GetDistinct(connection, obj);


                //    ds.Tables[0].Rows[0]["Supp_ID"].ToString();
                //  txtVendorName.Text = ds.Tables[0].Rows[0]["Supp_ID"].ToString();
                txtID.Text         = ds.Tables[0].Rows[0]["SuppID"].ToString();
                txtVendorName.Text = ds.Tables[0].Rows[0]["SupName"].ToString();
                txtaddress.Text    = ds.Tables[0].Rows[0]["Address"].ToString();
                txtcity.Text       = ds.Tables[0].Rows[0]["City"].ToString();
                txtState.Text      = ds.Tables[0].Rows[0]["State"].ToString();
                txtCounty.Text     = ds.Tables[0].Rows[0]["Country"].ToString();
                txtPincode.Text    = ds.Tables[0].Rows[0]["Pincode"].ToString();
                txtphone.Text      = ds.Tables[0].Rows[0]["Phone"].ToString();
                txtfax.Text        = ds.Tables[0].Rows[0]["Fax"].ToString();
                txtmobile.Text     = ds.Tables[0].Rows[0]["Mobile"].ToString();
                txtpager.Text      = ds.Tables[0].Rows[0]["Pager"].ToString();
                txtEmail.Text      = ds.Tables[0].Rows[0]["Email"].ToString();
                txtConPerson.Text  = ds.Tables[0].Rows[0]["ConPerson"].ToString();
                txtDiscount.Text   = ds.Tables[0].Rows[0]["Discount"].ToString();
                txtCredit.Text     = ds.Tables[0].Rows[0]["Credit"].ToString();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ResultObject resultObj;

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_VENDOR", out List <M_Vendor> c_lstVend))
                {
                    var m_Vendor = c_lstVend.Find(v => v.Id == id);

                    if (m_Vendor == null)
                    {
                        return(NotFound());
                    }

                    m_Vendor.Updated_By = await base.CurrentUserId();

                    using (var vendBll = new VendorBLL())
                    {
                        resultObj = await vendBll.DeleteVendor(m_Vendor);

                        _cache.Remove("CACHE_MASTER_VENDOR");
                    }

                    return(Json(new { success = true, data = (M_Vendor)resultObj.ObjectValue, message = "Vendor Deleted." }));
                }

                using (var vendBll = new VendorBLL())
                {
                    var lstVend = await vendBll.GetVendor(id);

                    var m_Vendor = lstVend.First();

                    if (m_Vendor == null)
                    {
                        return(NotFound());
                    }

                    m_Vendor.Updated_By = await base.CurrentUserId();

                    resultObj = await vendBll.DeleteVendor(m_Vendor);

                    _cache.Remove("CACHE_MASTER_VENDOR");
                }

                return(Json(new { success = true, data = (M_Vendor)resultObj.ObjectValue, message = "Vendor Deleted." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Exemplo n.º 7
0
        private void BindGrid()
        {
            ds                   = VendorBLL.GetAllVendors(connection);
            ProductSet           = ds;
            gdvVendor.DataSource = null;
            gdvVendor.DataSource = ds;
            gdvVendor.DataBind();
            //drpVendor.DataSource = ds;
            //drpVendor.Items.Insert(0, new ListItem("Select Product", ""));
            //drpVendor.DataTextField = "SupName";
            //drpVendor.DataValueField = "Supp_ID";

            //drpVendor.DataBind();
        }
Exemplo n.º 8
0
        private void BindGridDistinct(int ID)
        {
            Vendor vendor = new Vendor();

            vendor.supp_ID       = ID;
            ds                   = VendorBLL.GetDistinct(connection, vendor);
            ProductSet           = ds;
            gdvVendor.DataSource = null;
            gdvVendor.DataSource = ds;
            gdvVendor.DataBind();
            //drpVendor.DataSource = ds;
            //drpVendor.Items.Insert(0, new ListItem("Select Product", ""));
            //drpVendor.DataTextField = "SupName";
            //drpVendor.DataValueField = "Supp_ID";

            //drpVendor.DataBind();
        }
Exemplo n.º 9
0
 protected void gdvVendor_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         VendorBLL _vendorBll = new VendorBLL();
         Label     ID         = (Label)gdvVendor.Rows[e.RowIndex].FindControl("lblSupID");
         int       id         = int.Parse(ID.Text);
         Vendor    vendor     = new Vendor();//= empid.Text;
         vendor.supp_ID = id;
         _vendorBll.Delete(vendor, connection);
     }
     catch (Exception exp) { }
     finally
     {
         gdvVendor.EditIndex = -1;
         BindGrid();
     }
 }
Exemplo n.º 10
0
        // GET: Master/Vendor/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ViewBag.CompCode = await base.CurrentUserComp();

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_VENDOR", out List <M_Vendor> c_lstVend))
                {
                    var m_Vendor = c_lstVend.Find(v => v.Id == id);

                    if (m_Vendor == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Vendor));
                }

                using (var vendBll = new VendorBLL())
                {
                    var lstVend = await vendBll.GetVendor(id);

                    var m_Vendor = lstVend.First();

                    if (m_Vendor == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Vendor));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
        }
Exemplo n.º 11
0
        //private void CheckUserAccess()
        //{
        //    if (!ReferenceEquals(Session[Constants.SESSION_USER_INFO], null))
        //    {
        //        IUser user = (IUser)Session[Constants.SESSION_USER_INFO];

        //        if (ReferenceEquals(user, null) || user.Id == 0)
        //        {
        //            Response.Redirect("~/Login.aspx");
        //        }

        //        if (user.UserRole.Id != (int)UserRole.Admin)
        //        {
        //            Response.Redirect("~/Unauthorized.aspx");
        //        }
        //    }
        //    else
        //    {
        //        Response.Redirect("~/Login.aspx");
        //    }
        //}

        private void LoadData()
        {
            VendorEntity oVendor = (VendorEntity)VendorBLL.GetVendor(Convert.ToInt32(hdnVendorID.Value));

            ddlVendorType.SelectedIndex = ddlVendorType.Items.IndexOf(ddlVendorType.Items.FindByValue(oVendor.VendorType));
            if (ddlVendorType.SelectedItem.Text == "CFS/ICD" || ddlVendorType.SelectedItem.Text == "ICD")
            {
                txtCfsCode.Enabled      = true;
                rfvCfdCode.Enabled      = true;
                ddlTerminalCode.Enabled = true;
            }
            else
            {
                txtCfsCode.Enabled      = false;
                rfvCfdCode.Enabled      = false;
                ddlTerminalCode.Enabled = false;
            }
            ddlLocationID.SelectedIndex = Convert.ToInt32(ddlLocationID.Items.IndexOf(ddlLocationID.Items.FindByValue(oVendor.LocationName)));
            PopulateDropDown((int)Enums.DropDownPopulationFor.TerminalCode, ddlTerminalCode, Convert.ToInt32(ddlLocationID.SelectedValue));

            ddlSalutation.SelectedIndex = Convert.ToInt32(ddlSalutation.Items.IndexOf(ddlSalutation.Items.FindByValue(oVendor.VendorSalutation.ToString())));
            if (ddlTerminalCode.Items.Count > 0)
            {
                ddlTerminalCode.SelectedIndex = Convert.ToInt32(ddlTerminalCode.Items.IndexOf(ddlTerminalCode.Items.FindByValue(oVendor.Terminalid.ToString())));
            }

            txtName.Text     = oVendor.VendorName;
            txtAddress.Text  = oVendor.VendorAddress;
            txtCfsCode.Text  = oVendor.CFSCode;
            TxtTAN.Text      = oVendor.TANo;
            TxtPAN.Text      = oVendor.PAN;
            TxtACNo.Text     = oVendor.AcNo;
            TxtAcType.Text   = oVendor.AcType;
            TxtBankName.Text = oVendor.BankName;
            TxtIEC.Text      = oVendor.IEC;
            TxtEmail.Text    = oVendor.EmailID;
            TxtBIN.Text      = oVendor.BIN;
            TxtMob.Text      = oVendor.Mobile;
            TxtCP.Text       = oVendor.CP;
        }
Exemplo n.º 12
0
        private void LoadAddress()
        {
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    CommonBLL commonBll = new CommonBLL();

                    gvwVendor.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwVendor.PageSize = searchCriteria.PageSize;
                    }

                    gvwVendor.DataSource = VendorBLL.GetVendor(searchCriteria, 0);
                    gvwVendor.DataBind();
                }
            }
        }
Exemplo n.º 13
0
 public ActionResult aaaa(int VenId)
 {
     return(Json(VendorBLL.ShowByName1(VenId), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 14
0
 public ActionResult ShowByName1(string name)
 {
     return(Json(VendorBLL.ShowByName1(name), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 15
0
 //根据供应商用户名或工号查询
 public ActionResult ShowByName(int pageIndex, int pageSize, int VenId, string VenName)
 {
     return(Json(VendorBLL.ShowByName(pageIndex, pageSize, VenId, VenName), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 16
0
 public ActionResult PageListDemo(int pageIndex, int PageSize)
 {
     return(Json(VendorBLL.PageListDemo(pageIndex, PageSize), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 17
0
 public ActionResult GetRows()
 {
     return(Json(VendorBLL.GetRows(), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 18
0
 public ActionResult updataVendor(Vendor d)
 {
     return(Json(VendorBLL.updataVendor(d), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 19
0
 public ActionResult VendorByids(int id)
 {
     return(Json(VendorBLL.VendorByid(id), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 20
0
 //添加供应商
 public ActionResult VendorAdd(Vendor ven)
 {
     return(Json(VendorBLL.VendorAdd(ven), JsonRequestBehavior.AllowGet));;
 }
Exemplo n.º 21
0
 private void DeleteLocation(int locId)
 {
     VendorBLL.DeleteVndor(locId);
     LoadAddress();
     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00010") + "');</script>", false);
 }
Exemplo n.º 22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                oVendorBll    = new VendorBLL();
                oVendorEntity = new VendorEntity();
                //oUserEntity = (UserEntity)Session[Constants.SESSION_USER_INFO]; // This section has been commented temporarily

                oVendorEntity.VendorType       = ddlVendorType.SelectedValue;
                oVendorEntity.LocationID       = Convert.ToInt32(ddlLocationID.SelectedValue);
                oVendorEntity.VendorSalutation = Convert.ToInt32(ddlSalutation.SelectedValue);
                oVendorEntity.VendorName       = txtName.Text.Trim();
                oVendorEntity.VendorAddress    = txtAddress.Text.Trim();
                oVendorEntity.CompanyID        = 1;//Need to populate from data base. This will be the company ID of the currently loggedin user.
                oVendorEntity.VendorActive     = true;
                oVendorEntity.AcNo             = TxtACNo.Text;
                oVendorEntity.AcType           = TxtAcType.Text;
                oVendorEntity.BankName         = TxtBankName.Text;
                oVendorEntity.BIN     = TxtBIN.Text;
                oVendorEntity.EmailID = TxtEmail.Text;
                oVendorEntity.IEC     = TxtIEC.Text;
                oVendorEntity.Mobile  = TxtMob.Text;
                oVendorEntity.TANo    = TxtTAN.Text;
                oVendorEntity.PAN     = TxtPAN.Text;
                oVendorEntity.CP      = TxtCP.Text;


                oVendorEntity.CFSCode = txtCfsCode.Text.Trim();
                if (ddlTerminalCode.Items.Count > 0 && ddlTerminalCode.SelectedIndex > 0)
                {
                    oVendorEntity.Terminalid = Convert.ToInt32(ddlTerminalCode.SelectedValue);
                }

                if (hdnVendorID.Value == "0")           // Insert
                {
                    oVendorEntity.CreatedBy  = _userId; // oUserEntity.Id;
                    oVendorEntity.CreatedOn  = DateTime.Today.Date;
                    oVendorEntity.ModifiedBy = _userId; // oUserEntity.Id;
                    oVendorEntity.ModifiedOn = DateTime.Today.Date;

                    switch (oVendorBll.AddEditVndor(oVendorEntity))
                    {
                    case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                        break;

                    case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009");
                        ClearAll();
                        break;
                    }
                }
                else // Update
                {
                    oVendorEntity.VendorId   = Convert.ToInt32(hdnVendorID.Value);
                    oVendorEntity.ModifiedBy = _userId;// oUserEntity.Id;
                    oVendorEntity.ModifiedOn = DateTime.Today.Date;

                    switch (oVendorBll.AddEditVndor(oVendorEntity))
                    {
                    case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                        break;

                    case 1: Response.Redirect("~/MasterModule/vendor-list.aspx");
                        break;
                    }
                }
            }
        }
Exemplo n.º 23
0
        public async Task <IActionResult> GetVendor(string vcode)
        {
            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_VENDOR", out List <M_Vendor> c_lstVend))
                {
                    if (string.IsNullOrEmpty(vcode))
                    {
                        return(Json(new { success = true, data = c_lstVend, message = "Get Vendor Success" }));
                    }
                    else
                    {
                        M_Vendor m_Vendor = c_lstVend.Find(v => v.VendorCode == vcode);

                        if (m_Vendor != null)
                        {
                            return(Json(new { success = true, data = m_Vendor, message = "Get Vendor Success" }));
                        }
                        else
                        {
                            return(Json(new { success = false, data = string.Empty, message = "Vendor Not Found" }));
                        }
                    }
                }

                MemoryCacheEntryOptions options = new MemoryCacheEntryOptions
                {
                    AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300),
                    SlidingExpiration = TimeSpan.FromSeconds(60),
                    Priority          = CacheItemPriority.NeverRemove
                };

                using (var vendBll = new VendorBLL())
                {
                    var lstVend = await vendBll.GetVendor(null);

                    _cache.Set("CACHE_MASTER_VENDOR", lstVend, options);

                    if (string.IsNullOrEmpty(vcode))
                    {
                        return(Json(new { success = true, data = lstVend, message = "Get Vendor Success" }));
                    }
                    else
                    {
                        M_Vendor m_Vendor = lstVend.Find(v => v.VendorCode == vcode);

                        if (m_Vendor != null)
                        {
                            return(Json(new { success = true, data = m_Vendor, message = "Get Vendor Success" }));
                        }
                        else
                        {
                            return(Json(new { success = false, data = string.Empty, message = "Vendor Not Found" }));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
        }