protected void Page_Load(object sender, EventArgs e) { if (IsPostBack != true) { this.Page.DataBind(); this.chkTruckScaled.Checked = true; if (Session["AddScalingGradingCode"] != null) { LoadPage(); LoadTruckInformation(); loadGradingInfo(); } this.cboWeigher.Items.Add(new ListItem("Please select Inveroty Controller", "")); List <UserBLL> list = UserRightBLL.GetUsersWithRight("Weigher"); if (list != null) { if (list.Count > 0) { foreach (UserBLL u in list) { this.cboWeigher.Items.Add(new ListItem(u.FullName, u.UserId.ToString())); } } } } if (this.gvDriverInformation.SelectedIndex == -1) { this.btnAdd.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack != true) { this.cboWeigher.Items.Add(new ListItem("Please select Inveroty Controller", "")); List <UserBLL> list = UserRightBLL.GetUsersWithRight("Weigher"); if (list != null) { if (list.Count > 0) { foreach (UserBLL u in list) { this.cboWeigher.Items.Add(new ListItem(u.FullName, u.UserId.ToString())); } } } if (Session["ScalingInfoEdit"].ToString() == "") { throw new Exception("The Session has expired"); } else { Guid ScalingId = new Guid(Session["ScalingInfoEdit"].ToString()); BindData(ScalingId); } } }
private void LoadSampler(Guid Id) { List <SamplerBLL> list = new List <SamplerBLL>(); SamplerBLL obj = new SamplerBLL(); list = obj.GetSamplerBySamplingId(Id); if (list != null) { this.cboSampler.Items.Clear(); List <UserBLL> listE = UserRightBLL.GetUsersWithRight("Sampler"); if (listE != null) { foreach (UserBLL b in listE) { this.cboSampler.Items.Add(new ListItem(b.UserName, b.UserId.ToString())); } if (list != null) { this.cboSampler.SelectedValue = list[0].SamplerId.ToString(); } } else { if (list != null) { foreach (SamplerBLL i in list) { this.cboSampler.Items.Add(new ListItem(UserBLL.GetName(i.SamplerId), i.SamplerId.ToString())); } } } } }
protected void Page_Load(object sender, EventArgs e) { Page.DataBind(); if (IsPostBack != true) { hfTrackingNo.Value = ""; LoadPage(); if (Session["AddUnLoadingId"] != null && Session["AddUnLoadingIdGradingCode"] != null) { cboGradingCode.Items.Add(new ListItem(Session["AddUnLoadingIdGradingCode"].ToString(), Session["AddUnLoadingId"].ToString())); cboGradingCode.SelectedValue = Session["AddUnLoadingId"].ToString(); selectedGradechanged(); } this.cboUnloadedBy.Items.Clear(); this.cboUnloadedBy.Items.Add(new ListItem("Please select Inveroty Controller", "")); List <UserBLL> list = UserRightBLL.GetUsersWithRight("InventoryController"); if (list != null) { if (list.Count > 0) { foreach (UserBLL u in list) { this.cboUnloadedBy.Items.Add(new ListItem(u.FullName, u.UserId.ToString())); } } } ViewState["TotalBagsSoFar"] = "0"; } cboGradingCode.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack != true) { EmployeeAttendanceBLL obj = new EmployeeAttendanceBLL(); List <UserBLL> list = UserRightBLL.GetUsersWithRight("Sampler"); this.cboSampler.Items.Add(new ListItem("Please Select Sampler", "")); this.cboSampler.AppendDataBoundItems = true; this.cboSampler.DataSource = list; this.cboSampler.DataTextField = "FullName"; this.cboSampler.DataValueField = "UserId"; this.cboSampler.DataBind(); } }
private void rptSampleTicketCoffee_DataInitialize(object sender, EventArgs e) { this.txtDateGenerated.Text = DateTime.Today.ToString("dd MMM-yyyy"); //Load Sample ticket with data. if (HttpContext.Current.Session["Sample"] != null) { SamplingBLL objSampling = new SamplingBLL(); objSampling = (SamplingBLL)HttpContext.Current.Session["Sample"]; objSampling = objSampling.GetSampleDetail(objSampling.Id); this.txtDateSampled.Text = objSampling.GeneratedTimeStamp.ToString("dd MMM-yyyy"); this.txtCode.Text = objSampling.SampleCode.ToString(); EmployeeAttendanceBLL objEmployee = new EmployeeAttendanceBLL(); this.txtSamplerName.Text = UserRightBLL.GetUserNameByUserId(objSampling._sampler.SamplerId); VoucherInformationBLL objVoucher = new VoucherInformationBLL(); objVoucher = objVoucher.GetVoucherInformationByCommodityDepositRequestId(objSampling.ReceivigRequestId); if (objVoucher != null) { this.txtNoBags.Text = objVoucher.NumberofBags.ToString(); this.txtPlompTruck.Text = objVoucher.NumberOfPlomps.ToString(); this.txtPlompTrailer.Text = objVoucher.NumberOfPlompsTrailer.ToString(); } //Get Driver information. List <DriverInformationBLL> list = new List <DriverInformationBLL>(); DriverInformationBLL obj = new DriverInformationBLL(); list = obj.GetActiveDriverInformationByReceivigRequestId(objSampling.ReceivigRequestId); if (list != null) { if (list.Count == 1) { obj = list[0]; this.txtPlateNo.Text = obj.PlateNumber.ToString(); this.txtTrailerPlateNo.Text = obj.TrailerPlateNumber.ToString(); } } } HttpContext.Current.Session["Sample"] = null; HttpContext.Current.Session["Sampler"] = null; }
protected void gvStackUnloaded_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { StackUnloadedBLL obj = (StackUnloadedBLL)e.Row.DataItem; if (this.gvStackUnloaded.EditIndex == -1) { Label lblInv = (Label)e.Row.FindControl("lblInvetoryCont"); Label lblStaclg = (Label)e.Row.FindControl("lblStackNo"); lblInv.Text = UserRightBLL.GetUserNameByUserId(obj.UserId); lblStaclg.Text = obj.StackNo; } else { //Label lblEditstat = (Label)e.Row.FindControl("lblEditstatus"); //DropDownList cboInv = (DropDownList)e.Row.FindControl("cboStackUnloadedStatus"); //cboInv.SelectedValue = lblEditstat.Text; } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack != true) { BindUnloading(); BindStackInformation(); this.cboUnloadedBy.Items.Clear(); this.cboUnloadedBy.Items.Add(new ListItem("Please select Inveroty Controller", "")); List <UserBLL> list = UserRightBLL.GetUsersWithRight("InventoryController"); if (list != null) { if (list.Count > 0) { foreach (UserBLL u in list) { this.cboUnloadedBy.Items.Add(new ListItem(u.FullName, u.UserId.ToString())); } } } } }
public bool IsAuthorized(string right) { if (Common.Versions == SoftwareVersions.S) { if (right == RightsText.ViewAuditTrail || right == RightsText.SignRecords) { return(false); } else { return(true); } } else { UserRightBLL rightbll = new UserRightBLL(); List <DAL.UserRight> Userright = rightbll.GetUserRightByUserName(tbAccount.Text.Trim().ToLower()); return(Userright.Select(p => p.Right).Contains(right)); } //return false; }
private IDictionary <object, string> GetWorkersLookup(string role) { CachedDictionary <string> workers = new CachedDictionary <string>( delegate(string user) { return(user); }, delegate(object key) { //return UserRightBLL.GetUsersWithRight(role).Find(u => u.UserId == (Guid)key).FullName; return(UserRightBLL.GetUserNameByUserId((Guid)key)); }, delegate() { return(new List <KeyValuePair <object, string> >( from user in UserRightBLL.GetUsersWithRight(role) select new KeyValuePair <object, string>(user.UserId, user.FullName))); }); ICollection <object> keys = workers.Keys; return(workers); }
private void CoffeeCodingReport_FetchData(object sender, FetchEventArgs eArgs) { string t = ""; try { reader.Read(); if (reader["UserId"] != DBNull.Value) { t = UserRightBLL.GetUserNameByUserId(new Guid(reader["UserId"].ToString())); Fields["Grader"].Value = UserRightBLL.GetUserNameByUserId(new Guid(reader["UserId"].ToString())); } if (reader["isSupervisor"] != DBNull.Value) { Fields["IsSuper"].Value = reader["isSupervisor"].ToString(); } eArgs.EOF = false; } catch (Exception ex) { eArgs.EOF = true; } }
private void rptGRN_ReportStart(object sender, EventArgs e) { if (HttpContext.Current.Session["GRNIDPrint"] == null) { throw new Exception("Session expired"); } Guid GRNId = Guid.Empty; GRNId = new Guid(HttpContext.Current.Session["GRNIDPrint"].ToString()); Guid GradingId = Guid.Empty; GRNBLL objGRN = new GRNBLL(); objGRN = objGRN.GetbyGRN_Number(GRNId); GradingId = objGRN.GradingId; this.lblGRN_No.Text = objGRN.GRN_Number; this.lblClient.Text = ClientBLL.GetClinetNameById(objGRN.ClientId); this.lblCommodityGrade.Text = CommodityGradeBLL.GetCommodityGradeNameById(objGRN.CommodityGradeId); this.lblWarehouse.Text = WarehouseBLL.GetWarehouseNameById(objGRN.WarehouseId); this.lblOriginalQuantity.Text = objGRN.OriginalQuantity.ToString(); this.lblNetWeight.Text = objGRN.NetWeight.ToString(); this.lblDateDeposited.Text = objGRN.DateDeposited.ToShortDateString(); this.lblTimeDeposited.Text = objGRN.DateDeposited.ToShortTimeString(); this.lblNoBags.Text = objGRN.TotalNumberOfBags.ToString(); //Bag Type BagTypeBLL objBt = new BagTypeBLL(); objBt.GetBagTypeById(objGRN.BagTypeId); lblBagType.Text = objBt.BagTypeName; //Driver Information List <DriverInformationBLL> list = null; DriverInformationBLL objDI = new DriverInformationBLL(); list = objDI.GetActiveDriverInformationByReceivigRequestId(objGRN.CommodityRecivingId); if (list != null) { string driverName = ""; string plateNo = ""; string driverLicense = ""; string licensceIssuedPlace = ""; foreach (DriverInformationBLL o in list) { if (driverName == "") { driverName = o.DriverName; } else { driverName += "," + o.DriverName; } if (plateNo == "") { if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true) { plateNo = o.PlateNumber + "-" + o.TrailerPlateNumber; } else { plateNo = o.PlateNumber; } } else { if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true) { plateNo += " , " + o.PlateNumber + "-" + o.TrailerPlateNumber; } else { plateNo += " , " + o.PlateNumber; } } if (driverLicense == "") { driverLicense = o.LicenseNumber; } else { driverLicense += " , " + o.LicenseNumber; } if (licensceIssuedPlace == "") { licensceIssuedPlace = o.LicenseIssuedPlace; } else { licensceIssuedPlace += " , " + o.LicenseIssuedPlace; } } this.lblDriverName.Text = driverName; this.lblPlateNo.Text = plateNo; this.lblDriverLicense.Text = driverLicense; this.lblPlaceIssued.Text = licensceIssuedPlace; } // Scaling ScalingBLL objScaling = new ScalingBLL(); objScaling = objScaling.GetById(objGRN.ScalingId); if (objScaling != null) { if (objScaling.WeigherId != null) { try { this.lblWeigherName.Text = UserRightBLL.GetUserNameByUserId(objScaling.WeigherId); } catch { } } } // Sampler SamplerBLL objSampler = new SamplerBLL(); objSampler = objSampler.GetActiveSamplingSupBySamplingId(objGRN.SamplingTicketId); if (objSampler != null) { this.lblSampler.Text = UserRightBLL.GetUserNameByUserId(objSampler.SamplerId); } //Graders GradingByBLL objGrader = new GradingByBLL(); this.lblGrader.Text = objGrader.GetSupGraderNameByGradingId(objGRN.GradingId); if (objGRN.ApprovedBy != null) { try { this.lblApprovedBy.Text = UserRightBLL.GetUserNameByUserId(objGRN.ApprovedBy); } catch { } } if (objGRN.ApprovedTimeStamp != null) { this.lblDateAproved.Text = objGRN.ApprovedTimeStamp.ToShortDateString(); } rpt = new rptGrading(GradingId); rptGS = new rptGRNService(GRNId); this.txtDateGenerated.Text = DateTime.Now.ToString(); ScalingBLL objSacling = new ScalingBLL(); objSacling = objSacling.GetById(objGRN.ScalingId); if (objSacling != null) { this.lblScaleTicketNo.Text = objSacling.ScaleTicketNumber; } this.subReport1.Report = rpt; this.subReport2.Report = this.rptGS; }
private void BindData() { this.cboSampleCode.Items.Clear(); // Load Combo with samplesPendingCoding List <SamplingResultBLL> list = new List <SamplingResultBLL>(); SamplingResultBLL obj = new SamplingResultBLL(); Guid WarehouseId = UserBLL.GetCurrentWarehouse(); string strSC = Session["GradingCodeId"].ToString(); list = obj.GetSamplesResultsPendingCoding(WarehouseId, strSC); this.cboSampleCode.Items.Add(new ListItem("Please Select Sample Code", String.Empty)); this.cboSampleCode.AppendDataBoundItems = true; //GradingDate if (list != null) { int flag = 0; foreach (SamplingResultBLL i in list) { string TempId = i.Id.ToString() + "/" + i.ReceivigRequestId.ToString() + "/" + i.TrackingNo; this.cboSampleCode.Items.Add(new ListItem(i.SamplingResultCode.ToString(), TempId)); if (Session["GradingCodeId"] == null) { this.lblMsg.Text = "your Session has expired"; return; } if (Session["GradingCodeId"].ToString().ToUpper() == i.SamplingResultCode.ToString().ToUpper()) { this.cboSampleCode.SelectedValue = TempId; //GradingDate this.txtSamplingResultDate.Text = i.ResultReceivedDateTime.ToShortDateString(); flag = 1; } } if (flag == 0) { this.cboSampleCode.SelectedIndex = -1; } } else { this.lblMsg.Text = "There are no samples Pending coding."; return; } List <UserBLL> listEmp = new List <UserBLL>(); try { listEmp = UserRightBLL.GetUsersWithRight("Grader"); } catch { this.lblMsg.Text = "No Graders for the warehouse"; return; } if (listEmp != null && listEmp.Count > 0) { this.cboGrader.Items.Clear(); this.cboGrader.AppendDataBoundItems = true; this.cboGrader.Items.Add(new ListItem("Please Select Grader.", "")); listEmp.Sort((x, y) => string.Compare(x.UserName, y.UserName)); foreach (UserBLL o in listEmp) { this.cboGrader.Items.Add(new ListItem(o.FullName, o.UserId.ToString())); } this.cboGrader.AppendDataBoundItems = false; } else { throw new Exception("No Graders Avalaible for the warehouse"); } }
//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); } }