Esempio n. 1
0
        private void LoadClient(Guid ClientId)
        {
            ClientBLL objClient = new ClientBLL();

            try
            {
                objClient = ClientBLL.GetClinet(ClientId);
                if (objClient != null)
                {
                    string strName = "";
                    try
                    {
                        strName = objClient.ClientName.ToString();
                    }
                    catch
                    {
                        this.lblmsg.Text     = "unable to get Client related Data";
                        this.lblmsg.CssClass = "message";
                        this.btnAdd.Enabled  = false;
                    }

                    this.lblClinet.Text = objClient.ClientId + " - " + strName;
                    hfClientId.Value    = ClientId.ToString();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to load client data", ex);
            }
        }
Esempio n. 2
0
        protected void txtClientId_TextChanged(object sender, EventArgs e)
        {
            ClientBLL objClient = null;

            if (this.txtClientId.Text != "")
            {
                objClient = new ClientBLL();
                objClient = ClientBLL.GetClinet(this.txtClientId.Text);
                if (objClient != null)
                {
                    if (objClient.ClientUniqueIdentifier == Guid.Empty)
                    {
                        this.lblMessage.ForeColor = System.Drawing.Color.Tomato;
                        this.lblMessage.Text      = "Temporary Client Id";
                        this.ClientGUID.Value     = Guid.Empty.ToString();
                        this.ClientName           = "Temporary Client Id";
                    }
                    else
                    {
                        if (objClient.ClientName != "" && objClient.ClientUniqueIdentifier != null)
                        {
                            lblMessage.ForeColor  = System.Drawing.Color.Green;
                            this.lblMessage.Text  = "[ " + objClient.ClientName + " ]" /*+ "-" + this.txtClientId.Text*/;
                            this.ClientGUID.Value = objClient.ClientUniqueIdentifier.ToString();
                            this.ClientName       = objClient.ClientName;
                        }
                        else
                        {
                            this.lblMessage.ForeColor = System.Drawing.Color.Tomato;
                            this.lblMessage.Text      = "Please Provide Client Id and try agin.";
                            this.ClientName           = "";
                        }
                    }
                }
                else
                {
                    this.lblMessage.ForeColor = System.Drawing.Color.Tomato;
                    this.lblMessage.Text      = "No Client Found!";
                }
            }
            else if (string.IsNullOrEmpty(this.txtClientId.Text))
            {
                this.lblMessage.Text  = "";
                this.ClientGUID.Value = Guid.Empty.ToString();
                this.ClientName       = null;
                objClient             = null;
            }
        }
Esempio n. 3
0
        private void LoadClient(Guid ClientId)
        {
            ClientBLL objClient = new ClientBLL();

            objClient = ClientBLL.GetClinet(ClientId);
            try
            {
                if (objClient != null)
                {
                    this.lblClinet.Text = objClient.ClientId.ToString() + " - " + objClient.ClientName.ToString();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to load client data", ex);
            }
        }
Esempio n. 4
0
        private void LoadClient(Guid ClientId)
        {
            ClientBLL objClient = new ClientBLL();

            objClient = ClientBLL.GetClinet(ClientId);
            try
            {
                if (objClient != null)
                {
                    this.lblClinet.Text = objClient.ClientId + " - " + objClient.ClientName.ToString();
                    hfClientId.Value    = ClientId.ToString();
                }
            }
            catch
            {
                this.lblmsg.Text = "Unable to load client data";
            }
        }
Esempio n. 5
0
 protected override SQLDataFilterParameter[] GetParameters(DataFilterCondition condition)
 {
     if (condition.Parameter.Name == "ClientId")
     {
         if (condition.LeftOperand == string.Empty)
         {
             return(new SQLDataFilterParameter[] { });
         }
         ClientBLL           requestedClient = ClientBLL.GetClinet(condition.LeftOperand);
         DataFilterParameter dfp             = new DataFilterParameter(
             "ClientId", string.Empty, typeof(Guid), string.Empty, FilterConditionType.Comparison);
         DataFilterCondition clientCondition = new DataFilterCondition(
             dfp, FilterConditionType.Comparison, "=", ((requestedClient == null)? Guid.Empty : requestedClient.ClientUniqueIdentifier).ToString());
         return(base.GetParameters(clientCondition));
     }
     else
     {
         return(base.GetParameters(condition));
     }
 }
Esempio n. 6
0
        private void LoadData()
        {
            string str = "";
            Guid   Id;

            if (Session["GRID"] != null)
            {
                str = Session["GRID"].ToString();
            }
            if (str == "")
            {
                this.lblMsg.Text = "Unable to load data please try again.";
                return;
            }
            try
            {
                Id = new Guid(str);
                this.hfId.Value = Id.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Update Data.", ex);
            }
            GradingResultBLL obj = new GradingResultBLL();

            obj = obj.GetGradingResultById(Id);

            if (obj != null)
            {
                this.cboGradingRecivedStatus.SelectedValue = ((int)obj.Status).ToString();
            }
            lblGradingReceivedDate.Text = obj.GradeRecivedTimeStamp.ToShortDateString();
            cmpSampGen.ValueToCompare   = obj.GradeRecivedTimeStamp.ToShortDateString();
            if (obj.GradingCode != null)
            {
                this.lblGradeCode.Text = obj.GradingCode;
            }
            this.lblClient.Text = "";
            string cg = "";
            CommodityDepositeRequestBLL obCD = new CommodityDepositeRequestBLL();

            obCD = obCD.GetCommodityDepositeDetailById(obj.CommodityDepositRequestId);
            ClientBLL objClient = new ClientBLL();

            objClient = ClientBLL.GetClinet(obCD.ClientId);
            if (objClient != null)
            {
                this.lblClient.Text = objClient.ClientName;
            }
            else
            {
                this.lblMsg.Text = "Unable to load client Data.";
            }

            cg = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId);
            this.lblCommodityGrade.Text = cg;
            if (((int)obj.Status == 3 || (int)obj.Status == 4) && obj.ClientAcceptanceTimeStamp != null)
            {
                this.cboAcceptanceStatus.SelectedValue = ((int)obj.Status).ToString();

                DateTime dtCA = DateTime.Now;
                if (obj.ClientAcceptanceTimeStamp == null)
                {
                    this.cboAcceptanceStatus.SelectedIndex = -1;
                }

                dtCA = (DateTime)obj.ClientAcceptanceTimeStamp;
                this.txtDateOfAcceptance.Text = dtCA.Date.ToShortDateString();
                this.txtTimeodAcceptance.Text = dtCA.ToLongTimeString();
                this.cboGradingRecivedStatus.SelectedValue = ((int)obj.GradingResult).ToString();
            }
        }
Esempio n. 7
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;
        }
Esempio n. 8
0
            //private CachedDictionary<ECXLookUp.CNIDType> nidTypeLookup = new CachedDictionary<ECXLookUp.CNIDType>(
            //                delegate(ECXLookUp.CNIDType nidType)
            //                {
            //                    return nidType.Name;
            //                },
            //                delegate(object key)
            //                {
            //                    return null;
            //                },
            //                delegate()
            //                {
            //                    ECXLookUp.ECXLookup ecxLookup = new WarehouseApplication.ECXLookUp.ECXLookup();
            //                    ECXLookUp.CNIDType[] nidTypes = ecxLookup.GetActiveNIDTypes(BLL.Utility.GetWorkinglanguage());
            //                    List<KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>> kvps = new List<KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>>();
            //                    foreach (ECXLookUp.CNIDType nidType in nidTypes)
            //                    {
            //                        kvps.Add(new KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>(nidType.Id, nidType));
            //                    }
            //                    return kvps;
            //                });
            //private Dictionary<object, string> shedLookup = new Dictionary<object,string>();
            //private Dictionary<object, string> stackLookup = new Dictionary<object,string>();
            //private CachedDictionary<BagTypeBLL> bagTypeLookup = new CachedDictionary<BagTypeBLL>(
            //    delegate(BagTypeBLL bagType)
            //    {
            //        return bagType.BagTypeName;
            //    },
            //    delegate(object key)
            //    {
            //        return BagTypeBLL.GetBagType((Guid)key);
            //    },
            //    delegate()
            //    {
            //        List<KeyValuePair<object, BagTypeBLL>> kvps = new List<KeyValuePair<object, BagTypeBLL>>();
            //        foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes())
            //        {
            //            kvps.Add(new KeyValuePair<object, BagTypeBLL>(bagType.Id, bagType));
            //        }
            //        return kvps;
            //    });

            //private WarehouseBLL currentWareHouse = new WarehouseBLL() {
            //    Code = "102",
            //    WarehouseId = new Guid("fa0a52e8-9308-4d5e-b323-88ca5ba232ed")
            //};
            #region ILookupSource Members

            public IDictionary <object, string> GetLookup(string lookupName)
            {
                try
                {
                    Dictionary <object, string> lookup = new Dictionary <object, string>();
                    switch (lookupName)
                    {
                    case "CommodityGrade":
                        return(new CachedDictionary <CommodityGradeBLL>(
                                   delegate(CommodityGradeBLL commodityGrade)
                        {
                            return commodityGrade.GradeName;
                        },
                                   delegate(object key)
                        {
                            return CommodityGradeBLL.GetCommodityGrade((Guid)key);
                        },
                                   delegate()
                        {
                            List <KeyValuePair <object, CommodityGradeBLL> > kvps = new List <KeyValuePair <object, CommodityGradeBLL> >();
                            foreach (CommodityGradeBLL commodityGrade in CommodityGradeBLL.GetAllCommodityDetail())
                            {
                                kvps.Add(new KeyValuePair <object, CommodityGradeBLL>(commodityGrade.CommodityGradeId, commodityGrade));
                            }
                            return kvps;
                        }));

                    case "Client":
                        return(new CachedDictionary <ClientBLL>(
                                   clientLookup,
                                   delegate(ClientBLL client)
                        {
                            return client.ClientName;
                        },
                                   delegate(object key)
                        {
                            return ClientBLL.GetClinet((Guid)key);
                        }));

                    case "ClientId":
                        return(new CachedDictionary <ClientBLL>(
                                   clientLookup,
                                   delegate(ClientBLL client)
                        {
                            return client.ClientId;
                        },
                                   delegate(object key)
                        {
                            return ClientBLL.GetClinet((Guid)key);
                        }));

                    case "Warehouse":
                        return(new CachedDictionary <WarehouseBLL>(
                                   warehouseLookup,
                                   delegate(WarehouseBLL warehouse)
                        {
                            return warehouse.WarehouseName;
                        },
                                   delegate(object key)
                        {
                            return WarehouseBLL.GetById((Guid)key);
                        }));

                    case "WarehouseManager":
                        return(new CachedDictionary <string>(
                                   delegate(string warehouseManager)
                        {
                            return warehouseManager;
                        },
                                   delegate(object key)
                        {
                            //return UserRightBLL.GetUsersWithRight("WHPWM").Find(u => u.UserId == (Guid)key).FullName;
                            return UserRightBLL.GetUserNameByUserId((Guid)key);
                        }));

                    case "NIDType":
                        //ICollection<object> keys = nidTypeLookup.Keys;
                        //return nidTypeLookup;
                        List <NIDTypeBLL> nidTypes = NIDTypeBLL.GetAllNIDTypes();
                        nidTypes.ForEach(nidType => lookup.Add(nidType.Id, nidType.Name));
                        break;

                    case "VerifyingClerk":
                        //return GetWorkersLookup("VerifyingClerk");
                        UserRightBLL.GetUsersWithRight("VerifyingClerk").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "InventoryController":
                        //return GetWorkersLookup("InventoryController");
                        UserRightBLL.GetUsersWithRight("InventoryController").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Loader":
                        //return GetWorkersLookup("Loader");
                        UserRightBLL.GetUsersWithRight("Loader").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Weigher":
                        //return GetWorkersLookup("Weigher");
                        UserRightBLL.GetUsersWithRight("Weigher").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Sampler":
                        //return GetWorkersLookup("Sampler");
                        UserRightBLL.GetUsersWithRight("Sampler").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Grader":
                        //return GetWorkersLookup("Grader");
                        UserRightBLL.GetUsersWithRight("Grader").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Gatekeeper":
                        //return GetWorkersLookup("Gatekeeper");
                        UserRightBLL.GetUsersWithRight("Gatekeeper").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "Inspector":
                        //return GetWorkersLookup("Gatekeeper");
                        UserRightBLL.GetUsersWithRight("WHPCT").ForEach(user => lookup.Add(user.UserId, user.FullName));
                        break;

                    case "BagType":
                        foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes())
                        {
                            lookup.Add(bagType.Id, bagType.BagTypeName);
                        }
                        break;

                    case "BagWeight":
                        foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes())
                        {
                            lookup.Add(bagType.Id, bagType.Tare.ToString());
                        }
                        break;

                    case "CurrentWarehouse":
                        lookup.Add("Id", WarehouseBLL.CurrentWarehouse.WarehouseId.ToString());
                        lookup.Add("WarehouseCode", WarehouseBLL.CurrentWarehouse.Code);
                        //lookup.Add("WarehouseManagerId", currentWareHouse.WarehouseId.ToString());
                        //lookup.Add("WarehouseManagerName", "");
                        break;

                    case "CurrentUser":
                        lookup.Add("Id", UserBLL.GetCurrentUser().ToString());
                        lookup.Add("Name", UserBLL.GetName(UserBLL.GetCurrentUser()));
                        break;

                    case "WorkerStatus":
                        lookup.Add(0, "Status 1");
                        lookup.Add(1, "Status 2");
                        break;

                    case "EmployeeRole":
                        lookup.Add(WorkType.GINGrading, "0e604921-ee27-4406-97ce-846b47b1cd75");
                        lookup.Add(WorkType.GINLoading, "0e604921-ee27-4406-97ce-846c47b1cd75");
                        lookup.Add(WorkType.GINSampling, "0e604921-ee27-4406-97ce-84db47b1cd75");
                        lookup.Add(WorkType.GINScaling, "0e604921-ee27-4406-97ce-846e47b1cd75");
                        break;

                    case "Shed":
                        foreach (ShedBLL shed in new ShedBLL().GetActiveShedByWarehouseId(WarehouseBLL.CurrentWarehouse.WarehouseId))
                        {
                            lookup.Add(shed.Id, shed.ShedNumber);
                        }
                        break;

                    case "Stack":
                        foreach (Guid shedId in GetLookup("Shed").Keys)
                        {
                            foreach (StackBLL stack in new StackBLL().GetActiveStackbyShedId(shedId))
                            {
                                lookup.Add(stack.Id, stack.StackNumber);
                            }
                        }
                        break;

                    case "TruckType":
                        lookup.Add(Guid.Empty, "Not Registred");
                        TruckTypeBLL        objTT = new TruckTypeBLL();
                        List <TruckTypeBLL> list  = objTT.GetActiveTrucksTypes();
                        list.Sort(TruckTypeComp);
                        list.ForEach(tt => lookup.Add(tt.Id, tt.TruckTypeName));
                        break;
                    }
                    lookup.OrderBy(lkup => lkup.Value);
                    return(lookup);
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("Item not found for the {0} lookup.", lookupName), ex);
                }
            }