public void GetCompany() { DataSet ds; CustomProfile profile = CustomProfile.GetProfile(); iProductMasterClient productClient = new iProductMasterClient(); iUCCommonFilterClient objService = new iUCCommonFilterClient(); try { //ds = productClient.GetCompanyname(profile.DBConnection._constr); List <mCompany> CompanyLst = new List <mCompany>(); long UID = profile.Personal.UserID; string UserType = profile.Personal.UserType.ToString(); if (UserType == "Admin") { CompanyLst = objService.GetUserCompanyNameNEW(UID, profile.DBConnection._constr).ToList(); } else { CompanyLst = objService.GetCompanyName(profile.DBConnection._constr).ToList(); } //ddlcompany.DataSource = ds; ddlcompany.DataSource = CompanyLst; ddlcompany.DataTextField = "Name"; ddlcompany.DataValueField = "ID"; ddlcompany.DataBind(); ListItem lst = new ListItem { Text = "-Select-", Value = "0" }; ddlcompany.Items.Insert(0, lst); } catch { } finally { productClient.Close(); } }
protected void FillSites() { iUCCommonFilterClient objService = new iUCCommonFilterClient(); try { CustomProfile profile = CustomProfile.GetProfile(); List <mCompany> CompanyLst = new List <mCompany>(); string UserType = profile.Personal.UserType.ToString(); long UID = profile.Personal.UserID; if (UserType == "Admin") { // CompanyLst = objService.GetCompanyName(profile.DBConnection._constr).ToList(); // CompanyLst = objService.GetUserCompanyName(UID, profile.DBConnection._constr).ToList(); CompanyLst = objService.GetUserCompanyNameNEW(UID, profile.DBConnection._constr).ToList(); } else if (UserType == "User" || UserType == "Requester And Approver" || UserType == "Requester" || profile.Personal.UserType == "Requestor" || profile.Personal.UserType == "Requestor And Approver") { CompanyLst = objService.GetUserCompanyName(UID, profile.DBConnection._constr).ToList(); } else { CompanyLst = objService.GetCompanyName(profile.DBConnection._constr).ToList(); } ddlCompany.DataSource = CompanyLst; ddlCompany.DataBind(); if (UserType == "Admin") { // ListItem lstCmpny = new ListItem { Text = "-Select-", Value = "0" }; //ddlCompany.Items.Insert(0, lstCmpny); if (ddlCompany.Items.Count > 0) { ddlCompany.SelectedIndex = 0; //1; } hdnselectedCompany.Value = ddlCompany.SelectedValue.ToString(); List <mTerritory> SiteLst = new List <mTerritory>(); iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient(); // SiteLst = UCCommonFilter.GetSiteNameByUserID(Convert.ToInt16(UID), profile.DBConnection._constr).ToList(); int Cmpny = int.Parse(hdnselectedCompany.Value); SiteLst = WMGetSelDept(Cmpny, profile.Personal.UserID); ddlSites.DataSource = SiteLst; ddlSites.DataBind(); if (ddlSites.Items.Count > 0) { ddlSites.SelectedIndex = 0; // 1; } hdnselectedDept.Value = ddlSites.SelectedValue.ToString(); Session["DeptID"] = ddlSites.SelectedValue.ToString(); //long DeptID = UCCommonFilter.GetSiteIdOfUser(UID, profile.DBConnection._constr); hdnselectedDept.Value = DeptID.ToString(); Session["DeptID"] = DeptID.ToString(); //long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DeptID, profile.DBConnection._constr); hdnselectedCompany.Value = CompanyID.ToString(); //ddlContact1.DataSource = WMGetContactPersonLst(CompanyID); //WMGetContactPersonLst(DeptID); //ddlContact1.DataBind(); //ListItem lstContact = new ListItem { Text = "-Select-", Value = "0" }; //ddlContact1.Items.Insert(0, lstContact); //ddlAddress.DataSource = WMGetDeptAddress(CompanyID); //WMGetDeptAddress(DeptID); //ddlAddress.DataBind(); //ListItem lstAdrs = new ListItem { Text = "-Select-", Value = "0" }; //ddlAddress.Items.Insert(0, lstAdrs); } else if (UserType == "User" || UserType == "Requester And Approver" || UserType == "Requester" || profile.Personal.UserType == "Requestor" || profile.Personal.UserType == "Requestor And Approver") { ddlCompany.Enabled = false; List <mTerritory> SiteLst = new List <mTerritory>(); iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient(); //SiteLst = UCCommonFilter.GetDepartmentListUserWise(Convert.ToInt16(UID), profile.DBConnection._constr).ToList(); SiteLst = UCCommonFilter.GetSiteNameByUserID(Convert.ToInt16(UID), profile.DBConnection._constr).ToList(); ddlSites.DataSource = SiteLst; ddlSites.DataBind(); if (ddlSites.Items.Count > 0) { ddlSites.SelectedIndex = 1; } // ddlSites.Enabled = false; long DeptID = UCCommonFilter.GetSiteIdOfUser(UID, profile.DBConnection._constr); hdnselectedDept.Value = DeptID.ToString(); Session["DeptID"] = DeptID.ToString(); long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DeptID, profile.DBConnection._constr); hdnselectedCompany.Value = CompanyID.ToString(); //ddlContact1.DataSource = WMGetContactPersonLst(CompanyID); //WMGetContactPersonLst(DeptID); //ddlContact1.DataBind(); //ListItem lstContact = new ListItem { Text = "-Select-", Value = "0" }; //ddlContact1.Items.Insert(0, lstContact); //ddlAddress.DataSource = WMGetDeptAddress(CompanyID); //WMGetDeptAddress(DeptID); //ddlAddress.DataBind(); //ListItem lstAdrs = new ListItem { Text = "-Select-", Value = "0" }; //ddlAddress.Items.Insert(0, lstAdrs); } else { ListItem lstCmpny = new ListItem { Text = "-Select-", Value = "0" }; ddlCompany.Items.Insert(0, lstCmpny); if (ddlCompany.Items.Count > 0) { ddlCompany.SelectedIndex = 1; } List <mTerritory> SiteLst = new List <mTerritory>(); iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient(); SiteLst = UCCommonFilter.GetSiteNameByUserID(Convert.ToInt16(UID), profile.DBConnection._constr).ToList(); ddlSites.DataSource = SiteLst; ddlSites.DataBind(); if (ddlSites.Items.Count > 0) { ddlSites.SelectedIndex = 1; } long DeptID = UCCommonFilter.GetSiteIdOfUser(UID, profile.DBConnection._constr); hdnselectedDept.Value = DeptID.ToString(); Session["DeptID"] = DeptID.ToString(); long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DeptID, profile.DBConnection._constr); hdnselectedCompany.Value = CompanyID.ToString(); //ddlContact1.DataSource = WMGetContactPersonLst(CompanyID); //WMGetContactPersonLst(DeptID); //ddlContact1.DataBind(); //ListItem lstContact = new ListItem { Text = "-Select-", Value = "0" }; //ddlContact1.Items.Insert(0, lstContact); //ddlAddress.DataSource = WMGetDeptAddress(CompanyID); //WMGetDeptAddress(DeptID); //ddlAddress.DataBind(); //ListItem lstAdrs = new ListItem { Text = "-Select-", Value = "0" }; //ddlAddress.Items.Insert(0, lstAdrs); } } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Request Template", "FillSites"); } finally { objService.Close(); } }
protected void GetTemplateDetails() { iPartRequestClient objService = new iPartRequestClient(); mRequestTemplateHead ReqTmpHead = new mRequestTemplateHead(); try { CustomProfile profile = CustomProfile.GetProfile(); ReqTmpHead = objService.GetTemplateOrderHead(Convert.ToInt64(hdnTemplateID.Value), profile.DBConnection._constr); long SiteID = Convert.ToInt64(ReqTmpHead.Department); hdnselectedDept.Value = SiteID.ToString(); Session["DeptID"] = SiteID.ToString(); iUCCommonFilterClient objCommon = new iUCCommonFilterClient(); long CompanyID = objCommon.GetCompanyIDFromSiteID(SiteID, profile.DBConnection._constr); txtTitle.Text = ReqTmpHead.TemplateTitle.ToString(); ddlAccessType.SelectedValue = ReqTmpHead.Accesstype.ToString(); //ddlCompany.SelectedIndex = ddlCompany.Items.IndexOf(ddlCompany.Items.FindByValue(ReqTmpHead.Customer.ToString())); //cmp = long.Parse(ReqTmpHead.Customer.ToString()); List <mCompany> CompanyLst = new List <mCompany>(); string UserType = profile.Personal.UserType.ToString(); long UID = profile.Personal.UserID; if (UserType == "Admin") { // CompanyLst = objService.GetCompanyName(profile.DBConnection._constr).ToList(); // CompanyLst = objService.GetUserCompanyName(UID, profile.DBConnection._constr).ToList(); CompanyLst = objCommon.GetUserCompanyNameNEW(UID, profile.DBConnection._constr).ToList(); } else if (UserType == "User" || UserType == "Requester And Approver" || UserType == "Requester" || profile.Personal.UserType == "Requestor" || profile.Personal.UserType == "Requestor And Approver") { CompanyLst = objCommon.GetUserCompanyName(UID, profile.DBConnection._constr).ToList(); } else { CompanyLst = objCommon.GetCompanyName(profile.DBConnection._constr).ToList(); } ddlCompany.DataSource = CompanyLst; ddlCompany.DataBind(); ddlCompany.SelectedIndex = ddlCompany.Items.IndexOf(ddlCompany.Items.FindByValue(CompanyID.ToString())); //ddlCompany.Items.IndexOf(ddlCompany.Items.FindByValue(ReqTmpHead.Customer.ToString())); cmp = CompanyID; int Cmpny = int.Parse(CompanyID.ToString()); //Convert.ToInt16(ReqTmpHead.Customer.ToString()); ddlSites.DataSource = WMGetDept(Cmpny); ddlSites.DataBind(); ddlSites.SelectedIndex = ddlSites.Items.IndexOf(ddlSites.Items.FindByValue(ReqTmpHead.Department.ToString())); dpt = long.Parse(ReqTmpHead.Department.ToString()); txtRemark.Text = ReqTmpHead.Remark.ToString(); //ddlAddress.DataSource = WMGetDeptAddress(CompanyID); //WMGetDeptAddress(SiteID); //ddlAddress.DataBind(); //ddlAddress.SelectedIndex = ddlAddress.Items.IndexOf(ddlAddress.Items.FindByValue(ReqTmpHead.Address.ToString())); //adrs = long.Parse(ReqTmpHead.Address.ToString()); //ddlContact1.DataSource = WMGetContactPersonLst(CompanyID); //WMGetContactPersonLst(SiteID); //ddlContact1.DataBind(); //ddlContact1.SelectedIndex = ddlContact1.Items.IndexOf(ddlContact1.Items.FindByValue(ReqTmpHead.Contact1.ToString())); //c1 = long.Parse(ReqTmpHead.Contact1.ToString()); ////ddlContact2.DataSource = WMGetContactPerson2Lst(Convert.ToInt64(ReqTmpHead.Department), Convert.ToInt64(ddlContact1.SelectedIndex)); //ddlContact2.DataSource = WMGetContactPerson2Lst(CompanyID, Convert.ToInt64(ddlContact1.SelectedIndex)); //ddlContact2.DataBind(); //ddlContact2.SelectedIndex = ddlContact2.Items.IndexOf(ddlContact2.Items.FindByValue(ReqTmpHead.Contact2.ToString())); //c2 = long.Parse(ReqTmpHead.Contact2.ToString()); //lblAddress.Text = ddlAddress.SelectedItem.ToString(); DataSet dsTemplatePartLst = new DataSet(); dsTemplatePartLst = objService.GetTemplatePartLstByTemplateID(Convert.ToInt64(hdnTemplateID.Value), profile.DBConnection._constr); List <POR_SP_GetPartDetail_ForRequest_Result> TemplatePartList = new List <POR_SP_GetPartDetail_ForRequest_Result>(); if (dsTemplatePartLst.Tables[0].Rows.Count > 0) { for (int i = 0; i <= dsTemplatePartLst.Tables[0].Rows.Count - 1; i++) { TemplatePartList = objService.AddPartIntoRequest_TempData(dsTemplatePartLst.Tables[0].Rows[i]["PrdID"].ToString(), Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, SiteID, profile.DBConnection._constr).ToList(); string uom = objService.GetUOMName(Convert.ToInt64(dsTemplatePartLst.Tables[0].Rows[i]["UOMID"].ToString()), profile.DBConnection._constr); POR_SP_GetPartDetail_ForRequest_Result PartRequest = new POR_SP_GetPartDetail_ForRequest_Result(); PartRequest.Sequence = i + 1; PartRequest.RequestQty = Convert.ToDecimal(dsTemplatePartLst.Tables[0].Rows[i]["Qty"].ToString()); // Convert.ToDecimal(dictionary["RequestQty"]); PartRequest.Price = Convert.ToDecimal(dsTemplatePartLst.Tables[0].Rows[i]["Price"].ToString()); PartRequest.Total = Convert.ToDecimal(dsTemplatePartLst.Tables[0].Rows[i]["Total"].ToString()); PartRequest.IsPriceChange = Convert.ToInt16(dsTemplatePartLst.Tables[0].Rows[i]["IsPriceChange"].ToString()); PartRequest.UOMID = Convert.ToInt64(dsTemplatePartLst.Tables[0].Rows[i]["UOMID"].ToString()); PartRequest.UOM = uom; objService.UpdatePartRequest_TempData12(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), PartRequest, profile.DBConnection._constr); // objService.UpdatePartRequest_TempData(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), PartRequest, profile.DBConnection._constr); TemplatePartList = objService.GetExistingTempDataBySessionIDObjectName(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList(); } } Grid1.DataSource = TemplatePartList; Grid1.DataBind(); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Request Template", "GetTemplateDetails"); } finally { objService.Close(); } }