Ejemplo n.º 1
0
 public static CustomList<ItemMaster> GetAllItemMasterByItemCode(String itemCode)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     String sql = "select *from ItemMaster Where ItemCode='"+itemCode+"'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetData(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Ejemplo n.º 2
0
 public static CustomList<ItemMaster> FindAllItemMasterGroupWise()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     String sql = "select ItemCode,ItemDescription,ItemGroupID,ItemSubGroupID from ItemMaster";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetDataItem(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Ejemplo n.º 3
0
        private void PopulateItemMaster(ItemMaster itemMaster)
        {
            try
            {
                txtItemCode.Text = itemMaster.ItemCode;
                txtBuyingPrice.Text = itemMaster.BuyingPrice.ToString();
                txtSellingPrice.Text = itemMaster.SellingPrice.ToString();
                ddlItemGroup.SelectedValue = itemMaster.ItemGroupID.ToString();
                ddlItemGroup_SelectedIndexChanged(null,null);
                //ddlItemSubGroup.SelectedValue = itemMaster.ItemSubGroupID.ToString();
                ddlUOM1.SelectedValue = itemMaster.UOMID == 0 ? null : itemMaster.UOMID.ToString();

                DropDownList ddlItemSubGroup = (DropDownList)Panel1.FindControl("ddlItemSubGroup");
                ddlItemSubGroup.SelectedValue = itemMaster.ItemSubGroupID == 0 ? null : itemMaster.ItemSubGroupID.ToString();

                int count=0;
                foreach (SegmentNames sN in SegmentNamesList)
                {
                    DropDownList ddl = (DropDownList)Panel1.FindControl("ddl" + sN.SegName.ToString());
                    if (count == 0)
                        ddl.SelectedValue = itemMaster.ValueIDSeg1.ToString();
                   else if (count == 1)
                        ddl.SelectedValue = itemMaster.ValueIDSeg2.ToString();
                   else if (count == 2)
                        ddl.SelectedValue = itemMaster.ValueIDSeg3.ToString();
                   else if (count == 3)
                        ddl.SelectedValue = itemMaster.ValueIDSeg4.ToString();
                   else if (count == 4)
                        ddl.SelectedValue = itemMaster.ValueIDSeg5.ToString();
                   else if (count == 5)
                        ddl.SelectedValue = itemMaster.ValueIDSeg6.ToString();
                   else if (count == 6)
                        ddl.SelectedValue = itemMaster.ValueIDSeg7.ToString();
                   else if (count == 7)
                        ddl.SelectedValue = itemMaster.ValueIDSeg8.ToString();
                   else if (count == 8)
                        ddl.SelectedValue = itemMaster.ValueIDSeg9.ToString();
                   else if (count == 9)
                        ddl.SelectedValue = itemMaster.ValueIDSeg10.ToString();
                    count++;
                }
            }
            catch (Exception ex)
            {

                throw(ex);
            }
        }
Ejemplo n.º 4
0
 public static CustomList<ItemMaster> FindAllItemMaster()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     const String sql = "spFindItem";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetDataFindItem(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Ejemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList<ItemMaster> lstItemMaster = ItemMasterList;
                if (lstItemMaster.Count == 0)
                {
                    ItemMaster newItemMaster = new ItemMaster();
                    lstItemMaster.Add(newItemMaster);
                }
                SetDataFromControlToObj(ref lstItemMaster);

                if (!CheckUserAuthentication(lstItemMaster)) return;
                manager.SaveItemMaster(ref lstItemMaster);
                txtItemCode.Text = lstItemMaster[0].ItemCode;
                ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);
            }
            catch (SqlException ex)
            {
                this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }