private void LoadControls(SqlInt32 DistributorID)
    {
        DistributorENT entDistributor = new DistributorENT();
        DistributorBAL balDistributor = new DistributorBAL();

        entDistributor = balDistributor.SelectByPK(DistributorID);

        if (!entDistributor.BranchID.IsNull)
        {
            ddlBranchID.SelectedValue = entDistributor.BranchID.Value.ToString();
        }

        if (!entDistributor.DistributorName.IsNull)
        {
            txtDistributorName.Text = entDistributor.DistributorName.Value.ToString();
        }

        if (!entDistributor.MobileNo.IsNull)
        {
            txtMobileNo.Text = entDistributor.MobileNo.Value.ToString();
        }

        if (!entDistributor.VehicleType.IsNull)
        {
            txtVehicleType.Text = entDistributor.VehicleType.Value.ToString();
        }

        if (!entDistributor.VehicleNo.IsNull)
        {
            txtVehicleNo.Text = entDistributor.VehicleNo.Value.ToString();
        }
    }
예제 #2
0
    private void LoadDistributerList()
    {
        DistributorBAL bal = new DistributorBAL();

        gvDistributors.DataSource = bal.LoadDistributerList();
        gvDistributors.DataBind();
    }
    private void Search()
    {
        SqlInt32  DistributorID = SqlInt32.Null;
        SqlString MobileNo      = SqlString.Null;
        SqlInt32  BranchID      = SqlInt32.Null;

        if (ddlDistributorID.SelectedIndex > 0)
        {
            DistributorID = Convert.ToInt32(ddlDistributorID.SelectedValue);
        }

        if (ddlBranchID.SelectedIndex > 0)
        {
            BranchID = Convert.ToInt32(ddlBranchID.SelectedValue);
        }

        if (txtMobileSearch.Text.Trim() != "")
        {
            MobileNo = Convert.ToString(txtMobileSearch.Text.Trim());
        }

        DistributorBAL balDistributor = new DistributorBAL();
        DataTable      dtDistributor  = balDistributor.DistributorSelectSearch(DistributorID, BranchID, MobileNo);

        if (dtDistributor != null && dtDistributor.Rows.Count > 0)
        {
            gvDistributor.DataSource = dtDistributor;
            gvDistributor.DataBind();
        }
        else
        {
            gvDistributor.DataSource = null;
            gvDistributor.DataBind();
        }
    }
예제 #4
0
    protected void btnDeleteFooter4_Click(object sender, EventArgs e)
    {
        string         footer4ImageFile = Path.GetFileName(Server.MapPath(imgFooter4Image.ImageUrl));
        DistributorBAL distributerBAL   = new DistributorBAL();

        if (!string.IsNullOrEmpty(footer4ImageFile))
        {
            try
            {
                //Delete from M2m and ArcOrdering
                DeleteFooterImagesFiles(footer4ImageFile);

                //delete from db
                distributerBAL.DeleteFooter(Footers.Footer4.ToString(), txtUrlName.Text);

                btnConfirm.Visible = true;
                GetDistributorForId(Convert.ToInt32(Session[enumSessions.DistributerIdToUpdate.ToString()]));
                pnldistributordetails.Visible = true;

                string script1 = "alertify.alert('Footer4 deleted succeussfully.')";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script1, true);
                MaintainScrollPositionOnPostBack = false;
            }
            catch (Exception ex)
            {
                CSLOrderingARCBAL.LinqToSqlDataContext db = new CSLOrderingARCBAL.LinqToSqlDataContext();
                db.USP_SaveErrorDetails(Request.Url.ToString(), "btnDeleteFooter4_Click", Convert.ToString(ex.Message), Convert.ToString(ex.InnerException), Convert.ToString(ex.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));

                string script1 = "alertify.alert('Upload status for HeaderImage: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script1, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }
    }
예제 #5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DistributerUIDetail distributer;

        try
        {
            distributer = new DistributerUIDetail();
            distributer = LoadDataFromForm();

            CSLOrderingARCBAL.BAL.DistributorBAL bal = new DistributorBAL();
            bal.SaveDistributor(distributer);
            LoadDistributerList();

            btnConfirm.Visible = true;

            string script = "alertify.alert('URLName " + txtUrlName.Text + " update successful.');";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            MaintainScrollPositionOnPostBack = false;
        }

        catch (Exception ex)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnShowAll_Click", Convert.ToString(ex.Message), Convert.ToString(ex.InnerException), Convert.ToString(ex.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
            string script = "alertify.alert('URLName " + txtUrlName.Text + " update failed.');";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            MaintainScrollPositionOnPostBack = false;
        }
    }
 private void FillDistributorGridView()
 {
     if (Session["UserID"] != null)
     {
         DistributorBAL balDistributor = new DistributorBAL();
         DataTable      dtDistributor  = balDistributor.SelectAll();
         if (dtDistributor != null && dtDistributor.Rows.Count > 0)
         {
             gvDistributor.DataSource = dtDistributor;
             gvDistributor.DataBind();
         }
     }
 }
 protected void gvDistributor_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "DeleteRecord" && e.CommandArgument != null)
         {
             DistributorBAL balDistributor = new DistributorBAL();
             if (balDistributor.Delete(Convert.ToInt32(e.CommandArgument)))
             {
                 FillDistributorGridView();
             }
             else
             {
                 lblMessage.Text = balDistributor.Message;
             }
         }
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message.ToString();
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            #region Server Side Validation

            String strError = String.Empty;

            if (ddlBranchID.SelectedIndex == 0)
            {
                strError += "- Select Branch<br />";
            }

            if (txtDistributorName.Text.Trim() == String.Empty)
            {
                strError += "- Enter Distributor Name<br />";
            }

            if (txtMobileNo.Text.Trim() == String.Empty)
            {
                strError += "- Enter Mobile No<br />";
            }

            if (txtVehicleType.Text.Trim() == String.Empty)
            {
                strError += "- Enter Vehicle Type<br />";
            }

            if (txtVehicleNo.Text.Trim() == String.Empty)
            {
                strError += "- Enter Vehicle No<br />";
            }

            #endregion Server Side Validation

            DistributorENT entDistributor = new DistributorENT();
            DistributorBAL balDistributor = new DistributorBAL();

            #region Gather Data

            if (ddlBranchID.SelectedIndex > 0)
            {
                entDistributor.BranchID = Convert.ToInt32(ddlBranchID.SelectedValue);
            }

            if (txtDistributorName.Text.Trim() != String.Empty)
            {
                entDistributor.DistributorName = txtDistributorName.Text.Trim();
            }

            if (txtMobileNo.Text.Trim() != String.Empty)
            {
                entDistributor.MobileNo = txtMobileNo.Text.Trim();
            }

            if (txtVehicleType.Text.Trim() != String.Empty)
            {
                entDistributor.VehicleType = txtVehicleType.Text.Trim();
            }

            if (txtVehicleNo.Text.Trim() != String.Empty)
            {
                entDistributor.VehicleNo = txtVehicleNo.Text.Trim();
            }

            entDistributor.UserID = Convert.ToInt32(Session["UserID"]);

            if (Request.QueryString["DistributorID"] == null)
            {
                balDistributor.Insert(entDistributor);
                lblMessage.Text = "Data Inserted Successfully";
                ClearControls();
            }
            else
            {
                entDistributor.DistributorID = Convert.ToInt32(Request.QueryString["DistributorID"]);
                balDistributor.Update(entDistributor);
                Response.Redirect("~/AdminPanel/Distributor/DistributorList.aspx");
            }

            #endregion Gather Data
        }
        catch (Exception ex)
        {
            lblErrorMessage.Text = ex.Message.ToString();
        }
    }
예제 #9
0
 private void GetDistributerUIByURLName(string urlName)
 {
     CSLOrderingARCBAL.BAL.DistributorBAL bal = new DistributorBAL();
     gvDistributors.DataSource = bal.GetDistributerUIByName(urlName);
     gvDistributors.DataBind();
 }
예제 #10
0
    private void GetDistributorForId(int id)
    {
        DistributerUIDetail distributer = new DistributerUIDetail();
        DistributorBAL      bal         = new DistributorBAL();

        distributer = bal.GetDistributerForId(id);

        //load the data to the textfield.
        txtUrlName.Text = distributer.UrlName;


        txtSignUpHyperlinkcolor.Text           = distributer.SignUpHyperlinkcolor;
        drpDefaultPageToNavigate.SelectedValue = distributer.PagetoNavigateafterSignin;

        // drpDefaultPageToNavigate.SelectedValue = distributer.PagetoNavigateafterSignin;

        txtSignInButtoncolor.Text = distributer.SignInButtoncolor;
        txtFooterTextColor.Text   = distributer.FooterTextColor;
        txtFooterBgColor.Text     = distributer.FooterBgColor;

        if (!string.IsNullOrEmpty(distributer.HeaderImage))
        {
            imgHeaderImage.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.HeaderImage;
        }

        if (!string.IsNullOrEmpty(distributer.BannerImage))
        {
            imgBannerImage.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.BannerImage;
        }

        if (!string.IsNullOrEmpty(distributer.Footer1Image))
        {
            imgFooter1Image.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.Footer1Image;
        }
        txtFooter1Text.Text = distributer.Footer1Text;
        txtFooter1URL.Text  = distributer.Footer1URL;

        if (!string.IsNullOrEmpty(distributer.Footer2Image))
        {
            imgFooter2Image.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.Footer2Image;
        }
        txtFooter2Text.Text = distributer.Footer2Text;
        txtFooter2URL.Text  = distributer.Footer2URL;

        if (!string.IsNullOrEmpty(distributer.Footer3Image))
        {
            imgFooter3Image.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.Footer3Image;
        }
        txtFooter3Text.Text = distributer.Footer3Text;
        txtFooter3URL.Text  = distributer.Footer3URL;

        if (!string.IsNullOrEmpty(distributer.Footer4Image))
        {
            imgFooter4Image.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.Footer4Image;
        }
        txtFooter4Text.Text = distributer.Footer4Text;
        txtFooter4URL.Text  = distributer.Footer4URL;

        if (!string.IsNullOrEmpty(distributer.MainImage))
        {
            imgMainImage.ImageUrl = ConfigurationManager.AppSettings["DistributerImages"].ToString() + distributer.MainImage;
        }
    }
예제 #11
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        DistributerUIDetail distributer    = new DistributerUIDetail();
        DistributorBAL      distributerBAL = new DistributorBAL();

        distributer = distributerBAL.GetDistributerUIByName(txtUrlName.Text);


        if (!string.IsNullOrEmpty(distributer.HeaderImage))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.HeaderImage;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.HeaderImage;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script1 = "alertify.alert('Upload status for HeaderImage: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script1, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        if (!string.IsNullOrEmpty(distributer.BannerImage))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.BannerImage;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.BannerImage;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script1 = "alertify.alert('Upload status for BannerImage: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script1, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        if (!string.IsNullOrEmpty(distributer.Footer4Image))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.Footer4Image;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.Footer4Image;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script2 = "alertify.alert('Upload status for Footer4Image: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script2, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }


        if (!string.IsNullOrEmpty(distributer.Footer3Image))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.Footer3Image;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.Footer3Image;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script2 = "alertify.alert('Upload status for Footer3Image: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script2, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        if (!string.IsNullOrEmpty(distributer.Footer2Image))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.Footer2Image;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.Footer2Image;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script3 = "alertify.alert('Upload status for Footer2Image: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script3, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        if (!string.IsNullOrEmpty(distributer.Footer1Image))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.Footer1Image;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.Footer1Image;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script4 = "alertify.alert('Upload status for Footer1Image: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script4, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        if (!string.IsNullOrEmpty(distributer.MainImage))
        {
            try
            {
                string sourceFileName      = ConfigurationManager.AppSettings["ARCImagesPath"] + distributer.MainImage;
                string destinationFileName = ConfigurationManager.AppSettings["M2MImagesPath"] + distributer.MainImage;

                System.IO.File.Copy(sourceFileName, destinationFileName, true);
            }
            catch (Exception ex)
            {
                string script6 = "alertify.alert('Upload status for MainImage: The file could not be uploaded. The following error occured: '" + ex.Message + ")";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script6, true);
                MaintainScrollPositionOnPostBack = false;
            }
        }

        try
        {
            distributerBAL.UpdateForConfirmation(txtUrlName.Text);
        }
        catch (Exception ex)
        {
            string script5 = "alertify.alert('Failed to update the Active flag. The following error occured: '" + ex.Message + ")";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script5, true);
            MaintainScrollPositionOnPostBack = false;
        }
        string script = "alertify.alert('URLName " + txtUrlName.Text + " confirm successful.');";

        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
        MaintainScrollPositionOnPostBack = false;
    }