Пример #1
0
 /// <summary>
 ///  This method will get all the allocated user
 /// </summary>
 /// <param name="ProductId"></param>
 private void BindEditProduct(int ProductId)
 {
     try
     {
         lstUsers = new List <AllocateProduct>();
         List <AllocateProduct> lstProduct  = new List <AllocateProduct>();
         string        customTableClassName = "KDA.UserAllocatedProducts";
         DataClassInfo customTable          = DataClassInfoProvider.GetDataClassInfo(customTableClassName);
         if (customTable != null)
         {
             var customTableData = CustomTableItemProvider.GetItems(customTableClassName)
                                   .WhereStartsWith("ProductID", ProductId.ToString());
             foreach (CustomTableItem item in customTableData)
             {
                 AllocateProduct objProduct = new AllocateProduct();
                 objProduct.EmailID  = ValidationHelper.GetString(item.GetValue("EmailID"), string.Empty);
                 objProduct.UserName = UserInfoProvider.GetUserInfo(ValidationHelper.GetInteger(item.GetValue("UserID"), 0)).FullName;
                 objProduct.Quantity = ValidationHelper.GetInteger(item.GetValue("Quantity"), 0);
                 objProduct.UserID   = ValidationHelper.GetInteger(item.GetValue("UserID"), 0);
                 lstProduct.Add(objProduct);
             }
             lstUsers.AddRange(lstProduct);
         }
         RepSelectedUser.DataSource = lstProduct;
         RepSelectedUser.DataBind();
     }
     catch (Exception ex)
     {
         EventLogProvider.LogException("Product allocation update BindEdit", "EXCEPTION", ex);
     }
 }
Пример #2
0
 /// <summary>
 /// Handles the Click event of the Allocate product button click .
 /// </summary>
 protected void AllocateProduct_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (RepeaterItem ri in RepterDetails.Items)
         {
             CheckBox item_check = (CheckBox)ri.FindControl("chkAllocate");
             if (item_check.Checked)
             {
                 int index     = lstUsers.FindIndex(item => item.UserID == ValidationHelper.GetInteger(((Label)ri.FindControl("lblUserid")).Text, 0));
                 var userEmail = ValidationHelper.GetString(((Label)ri.FindControl("lblEmail")).Text, string.Empty);
                 if (index == -1)
                 {
                     AllocateProduct objAllocateProduct = new AllocateProduct();
                     objAllocateProduct.UserID   = ValidationHelper.GetInteger(((Label)ri.FindControl("lblUserid")).Text, 0);
                     objAllocateProduct.UserName = ValidationHelper.GetString(((Label)ri.FindControl("lblUserName")).Text, string.Empty);
                     objAllocateProduct.EmailID  = ValidationHelper.GetString(((Label)ri.FindControl("lblEmail")).Text, string.Empty);
                     objAllocateProduct.Quantity = ValidationHelper.GetInteger(((TextBox)ri.FindControl("txtAllQuantity")).Text, 0);
                     lstUsers.Add(objAllocateProduct);
                 }
                 else
                 {
                     if (lstUsers.Count > 0)
                     {
                         lstUsers.Where(x => x.EmailID == userEmail).FirstOrDefault().Quantity = ValidationHelper.GetInteger(((TextBox)ri.FindControl("txtAllQuantity")).Text, 0);
                     }
                 }
             }
             else
             {
                 int index = lstUsers.FindIndex(item => item.UserID == ValidationHelper.GetInteger(((Label)ri.FindControl("lblUserid")).Text, 0));
                 if (index != -1)
                 {
                     lstUsers.RemoveAt(index);
                 }
             }
         }
         RepSelectedUser.DataSource = lstUsers;
         RepSelectedUser.DataBind();
     }
     catch (Exception ex)
     {
         EventLogProvider.LogInformation("CMSWebParts_Kadena_Add_inventory_Products_AllocateProduct", "AllocateProduct_Click", ex.Message);
     }
 }
Пример #3
0
 /// <summary>
 /// Empty all the field of the form
 /// </summary>
 private void EmptyFields(bool IsChanged)
 {
     if (IsChanged)
     {
         ddlPosNo.SelectedIndex = 0;
     }
     ddlBrand.SelectedIndex        = 0;
     ddlProdCategory.SelectedIndex = 0;
     ddlState.SelectedIndex        = 0;
     ddlStatus.SelectedIndex       = 0;
     txtActualPrice.Text           = string.Empty;
     txtBundleQnt.Text             = string.Empty;
     txtEstPrice.Text           = string.Empty;
     txtExpDate.Text            = string.Empty;
     txtLongDes.Text            = string.Empty;
     txtQuantity.Text           = string.Empty;
     txtShortDes.Text           = string.Empty;
     txtWeight.Text             = string.Empty;
     RepSelectedUser.DataSource = string.Empty;
     RepSelectedUser.DataBind();
     lstUsers            = new List <Product.AllocateProduct>();
     imgProduct.ImageUrl = string.Empty;
 }