コード例 #1
0
        protected void BindAddressList(long DeptID)
        {
            List <VW_GetUserLocation> LocLst         = new List <VW_GetUserLocation>();
            List <tAddress>           AdrsLst        = new List <tAddress>();
            iUCCommonFilterClient     UCCommonFilter = new iUCCommonFilterClient();
            CustomProfile             profile        = CustomProfile.GetProfile();

            //string AdrsType = UCCommonFilter.GetAdrsType(DeptID, profile.DBConnection._constr);
            //if (AdrsType == "Location")
            //{
            //    tblAddAdrs.Attributes.Add("style", "display:none");
            //    gvContactPerson.Columns[0].Visible = false;
            LocLst = UCCommonFilter.GetLocationOfUser(profile.Personal.UserID, profile.DBConnection._constr).ToList();
            //AdrsLst = UCCommonFilter.GetUserLocation(profile.Personal.UserID, profile.DBConnection._constr).ToList();
            //}
            //else
            //{
            tblAddAdrs.Attributes.Add("style", "display:''");
            long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DeptID, profile.DBConnection._constr);

            // AdrsLst = UCCommonFilter.GetDeptAddressList(CompanyID, profile.DBConnection._constr).ToList();
            // AdrsLst = UCCommonFilter.GetDeptAddressListAdrsType(CompanyID, DeptID, profile.DBConnection._constr).ToList();
            //}
            gvContactPerson.DataSource = LocLst;
            gvContactPerson.DataBind();
        }
コード例 #2
0
        public static string WMSaveRequestHead(object objAdr, string State)
        {
            string                result         = "";
            CustomProfile         profile        = CustomProfile.GetProfile();
            iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient();
            tAddress              Adrs           = new tAddress();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objAdr;

                Adrs.AddressLine1 = dictionary["AddressLine1"].ToString();
                Adrs.City         = dictionary["City"].ToString();
                Adrs.County       = "Qatar";
                Adrs.State        = dictionary["State"].ToString();


                if (State == "Edit")
                {
                    Adrs.ID               = Convert.ToInt64(HttpContext.Current.Session["ConID"].ToString());
                    Adrs.LastModifiedBy   = profile.Personal.UserID.ToString();
                    Adrs.LastModifiedDate = DateTime.Now;

                    UCCommonFilter.EditAddress(Adrs, profile.DBConnection._constr);
                }
                else
                {
                    long DID       = Convert.ToInt64(HttpContext.Current.Session["DeptID"].ToString());
                    long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DID, profile.DBConnection._constr);

                    Adrs.ObjectName   = "Account";
                    Adrs.ReferenceID  = DID;
                    Adrs.RouteID      = CompanyID;
                    Adrs.CompanyID    = CompanyID;
                    Adrs.Sequence     = 1;
                    Adrs.AddressType  = "none";
                    Adrs.IsDefault    = "N";
                    Adrs.Active       = "Y";//Set Active Y N
                    Adrs.CreatedBy    = profile.Personal.UserID.ToString();
                    Adrs.CreationDate = DateTime.Now;
                    UCCommonFilter.AddIntotAddress(Adrs, profile.DBConnection._constr);
                }
                result = "Address saved successfully";
            }
            catch { result = "Some error occurred"; }
            finally { UCCommonFilter.Close(); }

            return(result);
        }
コード例 #3
0
        public static string WMSaveRequestHead(object objCon, string State)
        {
            string                result         = "";
            CustomProfile         profile        = CustomProfile.GetProfile();
            iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient();
            tContactPersonDetail  ConPerD        = new tContactPersonDetail();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objCon;

                ConPerD.Name     = dictionary["Name"].ToString();
                ConPerD.MobileNo = dictionary["MobileNo"].ToString();
                ConPerD.EmailID  = dictionary["EmailID"].ToString();

                if (State == "Edit")
                {
                    ConPerD.ID               = Convert.ToInt64(HttpContext.Current.Session["ConID"].ToString());
                    ConPerD.LastModifiedBy   = profile.Personal.UserID.ToString();
                    ConPerD.LastModifiedDate = DateTime.Now;
                    UCCommonFilter.EditContactPerson(ConPerD, profile.DBConnection._constr);
                }
                else
                {
                    long DID       = Convert.ToInt64(HttpContext.Current.Session["DeptID"].ToString());
                    long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DID, profile.DBConnection._constr);

                    ConPerD.ReferenceID    = CompanyID;
                    ConPerD.Department     = DID;
                    ConPerD.CompanyID      = CompanyID;
                    ConPerD.Sequence       = 1;
                    ConPerD.ObjectName     = "Contact";
                    ConPerD.CustomerHeadID = 0;
                    ConPerD.ContactTypeID  = 4;
                    ConPerD.Active         = "N";
                    ConPerD.CreatedBy      = profile.Personal.UserID.ToString();
                    ConPerD.CreationDate   = DateTime.Now;
                    UCCommonFilter.AddIntotContactpersonDetail(ConPerD, profile.DBConnection._constr);
                }
                result = "Contact saved successfully";
            }
            catch { result = "Some error occurred"; }
            finally { UCCommonFilter.Close(); }

            return(result);
        }
コード例 #4
0
        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(); }
        }
コード例 #5
0
        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(); }
        }