Пример #1
0
 public void BindCategory(string mode)
 {
     try
     {
         List <GetItemCategory_Result> lstcategory = new List <GetItemCategory_Result>();
         if (mode == "Add")
         {
             lstcategory = lclsservice.GetItemCategory().Where(a => a.IsActive == true).ToList();
         }
         else
         {
             lstcategory = lclsservice.GetItemCategory().ToList();
         }
         drdItemCategory.DataSource     = lstcategory;
         drdItemCategory.DataValueField = "CategoryID";
         drdItemCategory.DataTextField  = "CategoryName";
         drdItemCategory.DataBind();
         ListItem lst = new ListItem();
         lst.Value = "0";
         lst.Text  = "Select";
         drdItemCategory.Items.Insert(0, lst);
         drdItemCategory.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         EventLogger log = new EventLogger(config);
         log.LogException(ex);
         ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesErrorMessage.Replace("<<Itemname>>", ex.Message), true);
     }
 }
Пример #2
0
        public void BindCategoryadd(string mode)
        {
            try
            {
                InventoryServiceClient lclsservice = new InventoryServiceClient();
                List <GetItemCategory> lstcategory = null;
                if (mode == "Add")
                {
                    lstcategory = lclsservice.GetItemCategory().Where(a => a.IsActive == true).ToList();
                }
                else
                {
                    lstcategory = lclsservice.GetItemCategory().ToList();
                }
                drdItemCategory.DataSource     = lstcategory;
                drdItemCategory.DataValueField = "CategoryID";
                drdItemCategory.DataTextField  = "CategoryName";
                drdItemCategory.DataBind();
                ListItem lst = new ListItem();
                lst.Value = "0";
                lst.Text  = "Select";
                drdItemCategory.Items.Insert(0, lst);


                // Search Item Category Dropdown
            }
            catch (Exception ex)
            {
                EventLogger log = new EventLogger(config);
                log.LogException(ex);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true);
            }
        }
Пример #3
0
        private bool ValidateLoookups(InventoryServiceClient service)
        {
            bool   result     = true;
            string errmessage = "";
            //Item Category Lookup
            List <GetItemCategory_Result> lstCat = service.GetItemCategory().Where(a => a.IsActive == true && a.CategoryID == Convert.ToInt64(drdItemCategory.SelectedValue)).ToList();

            if (lstCat.Count == 0)
            {
                errmessage += "ItemCategory (" + drdItemCategory.SelectedItem.Text + ") , ";
                result      = false;
            }

            //UOM Lookup
            List <GetUom_Result> lstUOM = service.GetUom().Where(a => a.IsActivestr == "1" && a.UomID == Convert.ToInt64(ddlUOM.SelectedValue)).ToList();

            if (lstUOM.Count == 0)
            {
                errmessage += "UOM (" + ddlUOM.SelectedItem.Text + ") , ";
                result      = false;
            }

            if (!result)
            {
                LoadLookups("Add");
                EventLogger log = new EventLogger(config);
                string      msg = Constant.WarningLookupMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<values>>", errmessage).Replace("');", "");
                log.LogWarning(msg);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningLookupMessage.Replace("<<values>>", errmessage), true);
            }

            return(result);
        }
Пример #4
0
        public void BindCategory()
        {
            try
            {
                InventoryServiceClient lclsservice = new InventoryServiceClient();
                List <GetItemCategory> lstcategory = null;
                lstcategory = lclsservice.GetItemCategory().ToList();
                drpItemCategorySearch.DataSource     = lstcategory;
                drpItemCategorySearch.DataValueField = "CategoryID";
                drpItemCategorySearch.DataTextField  = "CategoryName";
                drpItemCategorySearch.DataBind();


                foreach (ListItem lst1 in drpItemCategorySearch.Items)
                {
                    lst1.Attributes.Add("class", "selected");
                    lst1.Selected = true;
                }
            }
            catch (Exception ex)
            {
                EventLogger log = new EventLogger(config);
                log.LogException(ex);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true);
            }
        }
Пример #5
0
        //private void LoadLookups(string mode)
        //{
        //    try
        //    {
        //        BindCategory(mode);
        //        BindItem(mode);
        //        BindVendor(mode);
        //    }
        //    catch (Exception ex)
        //    {
        //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true);
        //    }
        //}

        private bool ValidateLoookups(InventoryServiceClient service)
        {
            try
            {
                bool   result     = true;
                string errmessage = "";
                //Item Category Lookup
                List <GetItemCategory> lstCat = service.GetItemCategory().Where(a => a.IsActive == true && a.CategoryID == Convert.ToInt64(drdItemCategory.SelectedValue)).ToList();
                if (lstCat.Count == 0)
                {
                    errmessage += "ItemCategory (" + drdItemCategory.SelectedItem.Text + ") , ";
                    result      = false;
                }

                //Item based on Category Lookup
                List <GetDrpItemsByCategory> lstitemCat = service.GetDrpItemsByCategory(Convert.ToInt64(drdItemCategory.SelectedValue)).Where(a => a.IsActive == true && a.ItemID == Convert.ToInt64(drdItemID.SelectedValue)).ToList();
                if (lstitemCat.Count == 0)
                {
                    errmessage += "Item (" + drdItemID.SelectedItem.Text + ") , ";
                    result      = false;
                }

                //Vendor Lookup
                List <GetvendorDetails> lstvendor = service.GetvendorDetails("").Where(a => a.IsActive == true && a.VendorID == Convert.ToInt64(drdVendorID.SelectedValue)).ToList();
                if (lstvendor.Count == 0)
                {
                    errmessage += "Vendor (" + drdVendorID.SelectedItem.Text + ") ";
                    result      = false;
                }



                if (!result)
                {
                    EventLogger log = new EventLogger(config);
                    string      msg = Constant.WarningLookupMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<values>>", errmessage).Replace("');", "");
                    log.LogWarning(msg);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningLookupMessage.Replace("<<values>>", errmessage), true);
                }

                return(result);
            }
            catch (Exception ex)
            {
                EventLogger log = new EventLogger(config);
                log.LogException(ex);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true);
                return(false);
            }
        }
Пример #6
0
        public void BindCategory()
        {
            try
            {
                List <GetItemCategory> lstcategory = new List <GetItemCategory>();
                lstcategory                = lclsservice.GetItemCategory().ToList();
                drpcategory.DataSource     = lstcategory;
                drpcategory.DataTextField  = "CategoryName";
                drpcategory.DataValueField = "CategoryID";
                drpcategory.DataBind();

                foreach (ListItem lst in drpcategory.Items)
                {
                    lst.Attributes.Add("class", "selected");
                    lst.Selected = true;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ReportErrorMessage.Replace("<<Report>>", ex.Message), true);
            }
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                if (hdnfield.Value != "0")
                {
                    lcls.CategoryID = Convert.ToInt64(hdnfield.Value);
                }
                lcls.CategoryName = txtGroupName.Text;
                if (chkstan.Checked == true)
                {
                    lcls.Usage = "1";
                }
                else if (chknonstan.Checked == true)
                {
                    lcls.Usage = "0";
                }
                else
                {
                    lcls.Usage = null;
                }
                if (chkactive.Checked == true)
                {
                    lcls.IsActive = true;
                }
                else
                {
                    lcls.IsActive = false;
                }
                lcls.CreatedOn      = DateTime.Now;
                lcls.CreatedBy      = defaultPage.UserId;
                lcls.LastModifiedBy = defaultPage.UserId;
                string ErrMsg = string.Empty;
                List <GetItemCategory_Result> lstcat = lclsService.GetItemCategory().Where(a => a.CategoryName == txtGroupName.Text).ToList();

                if (lstcat.Count > 0)
                {
                    if (lcls.CategoryID == 0)
                    {
                        ErrMsg = "FC";
                    }
                    else
                    {
                        if (lcls.CategoryID != lstcat[0].CategoryID)
                        {
                            ErrMsg = "FC";
                        }
                    }
                }

                if (ErrMsg == "")
                {
                    string      lstrMessage = lclsService.InsertUpdateCategory(lcls);
                    EventLogger log         = new EventLogger(config);
                    string      msg         = Constant.ItemCategorySaveMessage.Replace("ShowPopup('", "").Replace("<<ItemCategory>>", txtGroupName.Text).Replace("');", "");
                    log.LogInformation(msg);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategorySaveMessage.Replace("<<ItemCategory>>", txtGroupName.Text), true);
                    hdnfield.Value = "0";
                    bindgrid();
                    clear();
                }
                else
                {
                    EventLogger log = new EventLogger(config);
                    string      msg = Constant.ItemCategoryWarningMessage.Replace("ShowwarningPopup('", "").Replace("<<ItemCategory>>", txtGroupName.Text).Replace("');", "");
                    log.LogWarning(msg);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategoryWarningMessage.Replace("<<ItemCategory>>", txtGroupName.Text), true);
                }
                //Functions objfun = new Functions();
                //objfun.MessageDialog(this, "Saved Successfully");
            }
            catch (Exception ex)
            {
                EventLogger log = new EventLogger(config);
                log.LogException(ex);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategoryErrorMessage.Replace("<<ItemCategory>>", ex.Message), true);
            }
        }