Exemple #1
0
        public int insertBranch(Organization org, BranchLocation branch)
        {
            int  OrganizationID   = 0;
            int  BranchLocationID = 0;
            bool insertResult     = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                OrganizationID = organizationhelper.insertupdateOrganizationHier(org, 'I');

                if (OrganizationID > 0)
                {
                    branch.Org_Hier_ID = OrganizationID;
                    BranchLocationID   = organizationhelper.insertupdateBranchLocation(branch, 'I');
                }
                if (BranchLocationID != 0 && OrganizationID != 0)
                {
                    insertResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(OrganizationID);
        }
Exemple #2
0
        public int insertVendor(Organization org, CompanyDetails company, BranchLocation location)
        {
            int  OrganizationID   = 0;
            int  CompanyDetailsID = 0;
            int  LocationID       = 0;
            bool insertResult     = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                OrganizationID = organizationhelper.insertupdateOrganizationHier(org, 'I');
                if (OrganizationID > 0)
                {
                    company.Org_Hier_ID  = OrganizationID;
                    CompanyDetailsID     = organizationhelper.insertupdateCompanyDetails(company, 'I');
                    location.Org_Hier_ID = OrganizationID;
                    LocationID           = organizationhelper.insertupdateBranchLocation(location, 'I');
                }

                if (OrganizationID > 0 && CompanyDetailsID > 0)

                {
                    insertResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(OrganizationID);
        }
Exemple #3
0
        public async Task <int> AddLocation(LocationDto requestDto)
        {
            try
            {
                var location = new Location
                {
                    Name = requestDto.Name,
                };
                _context.Location.Add(location);
                _context.SaveChanges();

                var branchLocation = new BranchLocation
                {
                    FkBranchId   = requestDto.BranchId,
                    FkLocationId = location.PkLocationId
                };

                _context.BranchLocation.Add(branchLocation);

                return(await Task.FromResult(_context.SaveChanges()));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginid"] != null)
            {
                // branch location on header
                BranchLocation loc = InstallUserBLL.Instance.GetUserBranchLocation(JGSession.UserId);
                BranchAddress1.InnerText = loc.BranchAddress1;
                BranchAddress2.InnerText = loc.BranchAddress2;
                Department.InnerText = loc.Department;
                Phone.InnerText = loc.PhoneNumber;
                Email.InnerText = loc.Email;

                lbluser.Text = Session["Username"].ToString().Trim();
                string AdminId = ConfigurationManager.AppSettings["AdminUserId"].ToString();
                imgProfile.ImageUrl = JGSession.UserProfileImg;

                if ((string)Session["AdminUserId"] == AdminId)
                {
                    Lidashboard.Visible = true;
                    Lihome.Visible = true;
                    Liprogress.Visible = true;
                    Li_sr_app.Visible = true;
                    //Licreateuser.Visible = true;
                    //Liedituser.Visible = true;
                    Lidefineperiod.Visible = true;
                    LiUploadprospect.Visible = true;
                    //Li_AssignProspect.Visible = true;
                }
                else
                {
                    if ((string)Session["usertype"] == "Admin" || (string)Session["usertype"] == "SM")
                    {
                        Lidashboard.Visible = true;
                        Lihome.Visible = true;
                        Liprogress.Visible = true;
                        Li_sr_app.Visible = true;
                    }
                    else if ((string)Session["usertype"] == "MM")
                    {
                        LiUploadprospect.Visible = true;
                        //Li_AssignProspect.Visible = true;
                        Li_sr_app.Visible = true;
                        //Licreateuser.Visible = true;
                        //Liedituser.Visible = true;
                    }
                    else
                    {
                        Lidefineperiod.Visible = false;
                        LiUploadprospect.Visible = false;
                        //Li_AssignProspect.Visible = false;
                    }
                }

            }
            else
            {
                Response.Redirect("/login.aspx?returnurl=" + Request.Url.PathAndQuery);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var page = HttpContext.Current.Handler as Page;

            if (page is ViewApplicantUser)
            {
                NavMenuLeft.Visible = false;
                divTask.Visible     = false;
            }

            if (Session["loginid"] != null)
            {
                // branch location on header
                BranchLocation loc = InstallUserBLL.Instance.GetUserBranchLocation(JGSession.UserId);
                if (loc != null)
                {
                    BranchAddress1.InnerText = loc.BranchAddress1;
                    BranchAddress2.InnerText = loc.BranchAddress2;
                    Department.InnerText     = loc.Department;
                    Phone.InnerText          = loc.PhoneNumber;
                    Email.InnerText          = loc.Email;

                    lbluser.Text        = Session["Username"].ToString() + " " + Session["LastName"].ToString();
                    lblDesignation.Text = JGSession.Designation;
                    imgProfile.ImageUrl = JGSession.UserProfileImg;
                    hLnkEditProfil.Text = JGSession.UserInstallId;
                    if (JGSession.LoginUserID != null)
                    {
                        hLnkEditProfil.NavigateUrl = "/Sr_App/CreateSalesUser.aspx?ID=" + JGSession.LoginUserID;
                    }
                    else
                    {
                        hLnkEditProfil.NavigateUrl = "#";
                    }

                    if ((string)Session["usertype"] == "SSE")
                    {
                        Li_Jr_app.Visible = false;
                    }
                    if ((string)Session["loginid"] == JGConstant.JUSTIN_LOGIN_ID)
                    {
                        // Li_Installer.Visible = true;
                    }
                    else
                    {
                        // Li_Installer.Visible = false;
                    }
                }
                //SetEmailCountersAccess();
            }
            else
            {
                //Session["PopUpOnSessionExpire"] = "Expire";
                //// Response.Redirect("/login.aspx");
                //ScriptManager.RegisterStartupScript(this, GetType(), "alsert", "alert('Your session has expired,login to continue');window.location='../login.aspx?returnurl=" + Request.Url.PathAndQuery + ";')", true);
            }
        }
        /// <summary>
        /// A method to insert or update the branch location in the database using parameter char(Flag)
        /// </summary>
        /// <param name="branchLocation"></param>
        /// <param name="Flag"></param>
        /// <returns>BranchLocationID</returns>
        public int insertupdateBranchLocation(BranchLocation branchLocation, char Flag)
        {
            int BranchLocationId = 0;

            try
            {
                if (branchLocation != null)
                {
                    conn.Open();
                    MySqlCommand cmd = new MySqlCommand("sp_insertupdateBranchLocation", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("p_Flag", MySqlDbType.VarChar, 1).Value                   = Flag;
                    cmd.Parameters.Add("p_Org_Hier_ID", MySqlDbType.Int32).Value                 = branchLocation.Org_Hier_ID;
                    cmd.Parameters.Add("p_Location_ID", MySqlDbType.Int32).Value                 = branchLocation.Branch_Id;
                    cmd.Parameters.Add("p_Location_Name", MySqlDbType.VarChar, 75).Value         = branchLocation.Branch_Name;
                    cmd.Parameters.Add("p_Address", MySqlDbType.VarChar, 450).Value              = branchLocation.Address;
                    cmd.Parameters.Add("p_Country_ID", MySqlDbType.Int32).Value                  = branchLocation.Country_Id;
                    cmd.Parameters.Add("p_State_ID", MySqlDbType.Int32).Value                    = branchLocation.State_Id;
                    cmd.Parameters.Add("p_City_ID", MySqlDbType.Int32).Value                     = branchLocation.City_Id;
                    cmd.Parameters.Add("p_Postal_Code", MySqlDbType.Int32).Value                 = branchLocation.Postal_Code;
                    cmd.Parameters.Add("p_Branch_Coordinates1", MySqlDbType.VarChar, 100).Value  = branchLocation.Branch_Coordinates1;
                    cmd.Parameters.Add("p_Branch_Coordinates2", MySqlDbType.VarChar, 100).Value  = branchLocation.Branch_Coordinates2;
                    cmd.Parameters.Add("p_Branch_CoordinateURL", MySqlDbType.VarChar, 100).Value = branchLocation.Branch_CoordinatesURL;
                    object objbranchlocationid = cmd.ExecuteScalar();
                    if (Convert.ToInt32(objbranchlocationid) > 0)
                    {
                        BranchLocationId = Convert.ToInt32(objbranchlocationid);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return(BranchLocationId);
        }
Exemple #7
0
        public bool updateBranch(Organization org, BranchLocation branch)
        {
            int  OrganizationID = 0;
            int  BranchID       = 0;
            bool updateResult   = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                OrganizationID = organizationhelper.insertupdateOrganizationHier(org, 'U');

                BranchID = organizationhelper.insertupdateBranchLocation(branch, 'U');
                {
                    updateResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(updateResult);
        }
Exemple #8
0
        public int insertCompany(Organization org, CompanyDetails company, BranchLocation branch)
        {
            int  OrganizationID   = 0;
            int  BranchLocationID = 0;
            int  CompanyDetailsID = 0;
            int  IndustryTypeID   = 0;
            bool insertResult     = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                OrganizationID = organizationhelper.insertupdateOrganizationHier(org, 'I');


                if (OrganizationID > 0)
                {
                    branch.Org_Hier_ID = OrganizationID;
                    BranchLocationID   = organizationhelper.insertupdateBranchLocation(branch, 'I');

                    if (OrganizationID > 0)
                    {
                        company.Org_Hier_ID = OrganizationID;
                        CompanyDetailsID    = organizationhelper.insertupdateCompanyDetails(company, 'I');
                    }
                }
                if (BranchLocationID > 0 && OrganizationID > 0 && CompanyDetailsID > 0)

                {
                    insertResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(OrganizationID);
        }
Exemple #9
0
        public bool updateCompany(Organization org, CompanyDetails company, BranchLocation branch)
        {
            int  insertOrganizationID   = 0;
            int  inserBranchID          = 0;
            int  insertCompanyDetailsID = 0;
            bool updateResult           = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                insertOrganizationID = organizationhelper.insertupdateOrganizationHier(org, 'U');

                inserBranchID          = organizationhelper.insertupdateBranchLocation(branch, 'U');
                insertCompanyDetailsID = organizationhelper.insertupdateCompanyDetails(company, 'U');
                {
                    updateResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(updateResult);
        }