Beispiel #1
0
        public static List <CommodityGradeBLL> GetAllCommodityDetail()
        {
            List <CommodityGradeBLL> list = new List <CommodityGradeBLL>();

            ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();

            // Get All Commodities
            ECXLookUp.CCommodity[] objCommodity = objEcxLookUp.GetAllCommodities(Utility.GetWorkinglanguage());
            foreach (ECXLookUp.CCommodity i in objCommodity)
            {
                ECXLookUp.CCommodityClass[] objCommodityClass = objEcxLookUp.GetAllCommodityClasses(Utility.GetWorkinglanguage(), i.UniqueIdentifier);
                foreach (ECXLookUp.CCommodityClass o in objCommodityClass)
                {
                    ECXLookUp.CCommodityGrade[] objGrade = objEcxLookUp.GetAllCommodityGrades(Utility.GetWorkinglanguage(), o.UniqueIdentifier);
                    foreach (ECXLookUp.CCommodityGrade c in objGrade)
                    {
                        CommodityGradeBLL objCG = new CommodityGradeBLL();
                        objCG.CommodityId      = i.UniqueIdentifier;
                        objCG.Commodity        = i.Name;
                        objCG.CommodityClassId = o.UniqueIdentifier;
                        objCG.ClassName        = o.Name;
                        objCG.CommodityGradeId = c.UniqueIdentifier;
                        objCG.GradeName        = c.Name;
                        objCG.Symbol           = c.Symbol;
                        list.Add(objCG);
                    }
                }
            }
            string cgs = string.Empty;

            list.ForEach(cg => cgs += string.Format("id - {0}, name - {1}{2}", cg.CommodityGradeId, cg.GradeName, Environment.NewLine));
            Utility.LogException(new Exception(cgs));
            return(list);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack != true)
            {
                Page.DataBind();
                try
                {
                    this.cboCommodity.Items.Add(new ListItem("Please Select Commodity", ""));
                    this.cboCommodity.AppendDataBoundItems = true;
                    ECXLookUp.ECXLookup    objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
                    ECXLookUp.CCommodity[] objCommodity = objEcxLookUp.GetActiveCommodities(Utility.GetWorkinglanguage());
                    this.cboCommodity.DataSource     = objCommodity;
                    this.cboCommodity.DataTextField  = "Name";
                    this.cboCommodity.DataValueField = "UniqueIdentifier";
                    this.cboCommodity.DataBind();
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                try
                {
                    // get the type of the current warehoouse.


                    this.cboWarehouse.Items.Add(new ListItem("Please Select Warehouse", ""));
                    this.cboWarehouse.AppendDataBoundItems = true;
                    List <WarehouseBLL> listWarehouse = WarehouseBLL.GetAllActiveWarehouse();
                    foreach (WarehouseBLL owarehouse in listWarehouse)
                    {
                        this.cboWarehouse.Items.Add(new ListItem(owarehouse.WarehouseName, owarehouse.WarehouseId.ToString()));
                    }
                    this.cboWarehouse.SelectedValue = UserBLL.GetCurrentWarehouse().ToString();
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                int currYear;
                currYear = int.Parse(ConfigurationSettings.AppSettings["CurrentEthiopianYear"]);
                this.cboProductionYear.Items.Add(new ListItem("Please Select Production Year.", ""));
                this.cboProductionYear.AppendDataBoundItems = true;
                for (int i = currYear - 2; i <= currYear; i++)
                {
                    this.cboProductionYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
            }
            else
            {
            }
        }
Beispiel #3
0
        public CascadingDropDownNameValue[] GetRegions(string knownCategoryValues, string category)
        {
            List <CascadingDropDownNameValue> l = new List <CascadingDropDownNameValue>();

            ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            ECXLookUp.CRegion[] objRegion    = objEcxLookUp.GetActiveRegions(WarehouseApplication.BLL.Utility.GetWorkinglanguage());
            foreach (ECXLookUp.CRegion region in objRegion)
            {
                l.Add(new CascadingDropDownNameValue(region.Name.ToString(), region.UniqueIdentifier.ToString()));
            }


            return(l.ToArray());
        }
Beispiel #4
0
        public static Nullable <float> GetLotSize(Guid CommodityGradeId, Guid Lang)
        {
            Nullable <float> LotSize;

            ECXLookUp.ECXLookup       objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            ECXLookUp.CCommodityGrade objCommodity = objEcxLookUp.GetCommodityGrade(Lang, CommodityGradeId);
            if (objCommodity != null)
            {
                LotSize = objCommodity.LotSize;
                return(objCommodity.LotSize);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
 public static CommodityGradeBLL GetCommodityGrade(Guid Id)
 {
     try
     {
         CommodityGradeBLL comGrade = commodityGradeCache.GetAllItems().SelectMany(gs => (from g in gs where g.CommodityGradeId == Id select g)).SingleOrDefault();
         if (comGrade == null)
         {
             ECXLookUp.ECXLookup       objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
             ECXLookUp.CCommodityGrade oGrade       = objEcxLookUp.GetCommodityGrade(Utility.GetWorkinglanguage(), Id);
             comGrade = (from grade in commodityGradeCache.GetItem(oGrade.CommodityClassUniqueIdentifier.ToString())
                         where grade.CommodityGradeId == Id select grade).SingleOrDefault();
         }
         return(comGrade);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
        public static List <commodityType> GetAllCoffeeTypes()
        {
            List <commodityType> list = null;

            ECXLookUp.ECXLookup        objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            ECXLookUp.CCommodityType[] objCommodity = objEcxLookUp.GetActiveCommodityTypes(Utility.GetWorkinglanguage());

            if (objCommodity != null && objCommodity.Length > 0)
            {
                list = new List <commodityType>();
                foreach (ECXLookUp.CCommodityType i in objCommodity)
                {
                    commodityType o = new commodityType();
                    o.Id   = i.UniqueIdentifier;
                    o.Name = i.Name;
                    list.Add(o);
                }
            }
            return(list);
        }
Beispiel #7
0
        public CascadingDropDownNameValue[] GetWoredas(string knownCategoryValues, string category)
        {
            string           ZoneID = "";
            StringDictionary kv;

            kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            if (!kv.ContainsKey("Zone") || kv["Zone"].ToString() == "")
            {
                throw new ArgumentException("Couldn't find selected Zone.");
            }
            ZoneID = kv["Zone"];
            List <CascadingDropDownNameValue> l = new List <CascadingDropDownNameValue>();

            ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            ECXLookUp.CWoreda[] objWoreda    = objEcxLookUp.GetActiveWoredas(WarehouseApplication.BLL.Utility.GetWorkinglanguage(), new Guid(ZoneID.ToString()));
            foreach (ECXLookUp.CWoreda woreda in objWoreda)
            {
                l.Add(new CascadingDropDownNameValue(woreda.Name.ToString(), woreda.UniqueIdentifier.ToString()));
            }
            return(l.ToArray());
        }
Beispiel #8
0
        public static List <GRNTypeBLL> GetActiveGRNTypes()
        {
            List <GRNTypeBLL> list;

            try
            {
                ECXLookUp.ECXLookup  objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
                ECXLookUp.CGRNType[] obj          = objEcxLookUp.GetActiveGRNTypes(Utility.GetWorkinglanguage());

                if (obj != null)
                {
                    if (obj.Count() > 0)
                    {
                        list = new List <GRNTypeBLL>();
                        foreach (ECXLookUp.CGRNType i in obj)
                        {
                            GRNTypeBLL o = new GRNTypeBLL();
                            o.Id   = i.UniqueIdentifier;
                            o.Name = i.Name;
                            list.Add(o);
                        }
                        return(list);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Get GRN Types.", ex);
            }
        }
Beispiel #9
0
 public static string GetCommodityGradeNameById(Guid Id)
 {
     try
     {
         ECXLookUp.ECXLookup       objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
         ECXLookUp.CCommodityGrade objCommodity = objEcxLookUp.GetCommodityGrade(Utility.GetWorkinglanguage(), Id);
         if (objCommodity != null)
         {
             CommodityGradeBLL obj = new CommodityGradeBLL();
             obj.GradeName        = objCommodity.Name;
             obj.CommodityClassId = objCommodity.CommodityClassUniqueIdentifier;
             return(obj.GradeName);
         }
         else
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #10
0
        public List <WarehouseServicesBLL> GetServices()
        {
            List <WarehouseServicesBLL> list = null;

            ECXLookUp.ECXLookup  objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            ECXLookUp.CService[] objServices  = objEcxLookUp.GetActiveServices(Utility.GetWorkinglanguage());
            if (objServices != null)
            {
                if (objServices.Count() > 0)
                {
                    list = new List <WarehouseServicesBLL>();
                    foreach (ECXLookUp.CService s in objServices)
                    {
                        WarehouseServicesBLL obj = new WarehouseServicesBLL();
                        obj.Id     = s.UniqueIdentifier;
                        obj.Name   = s.Name;
                        obj.Status = s.Status;
                        list.Add(obj);
                    }
                }
            }
            return(list);
        }
Beispiel #11
0
 public WoredaBLL GetWoredabyId(Guid WoredaId)
 {
     try
     {
         WoredaBLL           obj          = new WoredaBLL();
         ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
         ECXLookUp.CWoreda   objWoreda    = objEcxLookUp.GetWoreda(Utility.GetWorkinglanguage(), WoredaId);
         if (objWoreda != null)
         {
             obj.WoredaId   = objWoreda.UniqueIdentifier;
             obj.WoredaName = objWoreda.Name;
             obj.ZoneId     = objWoreda.ZoneUniqueIdentifier;
             return(obj);
         }
         else
         {
             return(null);
         }
     }
     catch
     {
         throw new Exception("can not get woreda Name.");
     }
 }
Beispiel #12
0
        private void LoadData(Guid Id)
        {
            //get The Id from the qs

            //Get the Commodity  deposite Request form.
            CommodityDepositeRequestBLL objEdit       = new CommodityDepositeRequestBLL();
            CommodityDepositRequest     objCommDepReq = new CommodityDepositRequest();
            DataSet dsResult = new DataSet();

            objEdit.Id = Id;
            dsResult   = objCommDepReq.getCommodityDepositRequestById(Id);
            Guid ClientGuid = new Guid(dsResult.Tables[0].Rows[0]["ClientId"].ToString());

            objEdit.ClientId          = ClientGuid;
            this.hfClientId.Value     = ClientGuid.ToString();
            this.txtNumberOfBags.Text = dsResult.Tables[0].Rows[0]["NumberofBags"].ToString();
            objEdit.NumberofBags      = int.Parse((dsResult.Tables[0].Rows[0]["NumberofBags"].ToString()));
            float weight = float.Parse(dsResult.Tables[0].Rows[0]["Weight"].ToString());

            if (weight == 0)
            {
                this.txtWeight.Text = "";
            }
            else
            {
                this.txtWeight.Text = dsResult.Tables[0].Rows[0]["Weight"].ToString();
            }
            objEdit.Weight                      = float.Parse(dsResult.Tables[0].Rows[0]["Weight"].ToString());
            this.txtRemark.Text                 = dsResult.Tables[0].Rows[0]["Remark"].ToString();
            objEdit.Remark                      = this.txtRemark.Text;
            this.dtDateTimeRecived.Text         = Convert.ToDateTime(dsResult.Tables[0].Rows[0]["DateTimeRecived"]).ToShortDateString();
            this.txtTimeArrival.Text            = Convert.ToDateTime(dsResult.Tables[0].Rows[0]["DateTimeRecived"]).ToLongTimeString();
            objEdit.DateTimeRecived             = Convert.ToDateTime((dsResult.Tables[0].Rows[0]["DateTimeRecived"]).ToString());
            this.cboReprsentative.SelectedValue = dsResult.Tables[0].Rows[0]["RepresentativeId"].ToString();
            objEdit.RepresentativeId            = Guid.Empty;
            if (dsResult.Tables[0].Rows[0]["WoredaId"] != DBNull.Value)
            {
                this.cboWoreda.SelectedValue = dsResult.Tables[0].Rows[0]["WoredaId"].ToString();
                objEdit.WoredaId             = new Guid(dsResult.Tables[0].Rows[0]["WoredaId"].ToString());
            }
            this.cboStatus.SelectedValue = dsResult.Tables[0].Rows[0]["Status"].ToString();
            objEdit.Status = int.Parse(dsResult.Tables[0].Rows[0]["Status"].ToString());
            //if (Convert.ToInt32((this.cboStatus.SelectedValue)) == 0 )
            //{
            //    //this.btnEdit.Enabled = false;
            //}
            // Display the Client Id from this
            // Id = dsResult.Tables[0].Rows[0]["ClientId"].ToString();

            ECXLookUp.ECXLookup objLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            //Populate Drop down from server cboCommodity
            this.cboCommodity.AppendDataBoundItems = true;
            ECXLookUp.CCommodity[] objCommodity = objLookUp.GetActiveCommodities(WarehouseApplicationConfiguration.GetWorkingLanguage());
            this.cboCommodity.DataSource     = objCommodity;
            this.cboCommodity.DataTextField  = "Name";
            this.cboCommodity.DataValueField = "UniqueIdentifier";
            this.cboCommodity.DataBind();
            this.cboCommodity.SelectedValue = dsResult.Tables[0].Rows[0]["CommodityId"].ToString();
            objEdit.CommodityId             = new Guid(dsResult.Tables[0].Rows[0]["CommodityId"].ToString());
            //Populate Region
            //ECXLookUp.CRegion[] objRegion = objLookUp.GetActiveRegions(WarehouseApplicationConfiguration.GetWorkingLanguage());
            //this.cboRegion.DataSource = objRegion;
            //this.cboRegion.DataTextField = "Name";
            //this.cboRegion.DataValueField = "UniqueIdentifier";
            //this.cboRegion.DataBind();


            string SelectedWoreda = "";

            SelectedWoreda = dsResult.Tables[0].Rows[0]["WoredaId"].ToString();


            if (SelectedWoreda != "")
            {
                ECXLookUp.CWoreda objWoreda     = objLookUp.GetWoreda(WarehouseApplicationConfiguration.GetWorkingLanguage(), new Guid(SelectedWoreda));
                Guid            SelectedZone    = new Guid(objWoreda.ZoneUniqueIdentifier.ToString());
                ECXLookUp.CZone objZoneSelected = objLookUp.GetZone(WarehouseApplicationConfiguration.GetWorkingLanguage(), SelectedZone);
                Guid            SelectedRegion  = new Guid(objZoneSelected.RegionUniqueIdentifier.ToString());
                this.cboRegion_CascadingDropDown.SelectedValue = SelectedRegion.ToString();
                this.cboZone_CascadingDropDown.SelectedValue   = SelectedZone.ToString();
                this.cboWoreda_CascadingDropDown.SelectedValue = SelectedWoreda;
            }



            // Bind Clinet
            ClientBLL objClient = new ClientBLL();

            objClient = ClientBLL.GetClinet(ClientGuid);

            if (objClient != null)
            {
                this.txtClient.Text    = objClient.ClientName + " - " + objClient.ClientId;
                this.txtClient.Enabled = false;
            }


            //Populate the Production Year
            // set because we will not have Production year no latter than 2007
            string strSelectedYear = dsResult.Tables[0].Rows[0]["ProductionYear"].ToString();
            int    currYear        = int.Parse(ConfigurationSettings.AppSettings["CurrentEthiopianYear"]);

            this.cboProductionYear.Items.Add(new ListItem("Please Select Production Year.", ""));
            this.cboProductionYear.AppendDataBoundItems = true;
            if (strSelectedYear != "")
            {
                if (int.Parse(strSelectedYear) < currYear - 2)
                {
                    this.cboProductionYear.Items.Add(new ListItem(strSelectedYear, strSelectedYear));
                }
            }
            for (int i = currYear - 2; i <= currYear; i++)
            {
                this.cboProductionYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            this.cboProductionYear.SelectedValue = dsResult.Tables[0].Rows[0]["ProductionYear"].ToString();
            if (dsResult.Tables[0].Rows[0]["ProductionYear"] != DBNull.Value)
            {
                objEdit.ProductionYear = int.Parse(dsResult.Tables[0].Rows[0]["ProductionYear"].ToString());
            }
            ViewState["CommDepOld"] = objEdit;
        }
Beispiel #13
0
 public static string GetServiceNameById(Guid Id)
 {
     ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
     ECXLookUp.CService  objServices  = objEcxLookUp.GetService(Utility.GetWorkinglanguage(), Id);
     return(objServices.Name);
 }