private void GetBulkUploadedOrderProudcts()
    {
        try
        {
            DataTable dtResult = UploadOrderBAL.GetBulkUploadedOrderProudcts(Session[enumSessions.User_Name.ToString()].ToString());
            dtResult.DefaultView.RowFilter = "Result = 'Success'";
            dtResult.DefaultView.RowFilter = "Result = 'Success'";
            rptUploadedProducts.DataSource = dtResult.DefaultView;
            rptUploadedProducts.DataBind();

            dtResult.DefaultView.RowFilter = "";
            dtResult.DefaultView.RowFilter = "Result <> 'Success'";
            rptErrorProducts.DataSource    = dtResult.DefaultView;
            rptErrorProducts.DataBind();

            dtResult.DefaultView.RowFilter = "";
            dtResult.DefaultView.RowFilter = "IsAnyDuplicate = true";

            if (dtResult.DefaultView.Count > 0)
            {
                string script = "alertify.alert('" + ltrDuplicate.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
        }
        catch (Exception objException)
        {
            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                db.USP_SaveErrorDetails(Request.Url.ToString(), "GetBulkUploadedMultipleOrderProudcts", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Name.ToString()]));
            }
        }
    }
Exemple #2
0
 /// <summary>
 /// The purpose of this method to edit the ARC branches details
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lnkEdit_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton  lnkbtn        = (LinkButton)sender;
         GridViewRow gvRow         = (GridViewRow)lnkbtn.NamingContainer;
         int         alarmDelArcId = 0;
         alarmDelArcId = Convert.ToInt32(gvArcBranches.DataKeys[gvRow.RowIndex].Value.ToString());
         if (alarmDelArcId > 0)
         {
             hdnAlarmDelARCMapId.Value = Convert.ToString(alarmDelArcId);
             using (db = new LinqToSqlDataContext())
             {
                 var alarmDelARCMap = db.AlarmDeliveryARCMappings.Where(x => x.ID == alarmDelArcId).Single();
                 if (alarmDelARCMap != null)
                 {
                     txtBranchArcCode.Text       = alarmDelARCMap.Branch_ARC_Code;
                     txtBranchArcName.Text       = alarmDelARCMap.Branch_ARC_Name;
                     txtBranchArcIdentifier.Text = alarmDelARCMap.Branch_ARC_Identifier;
                     chkIsDeleted.Checked        = alarmDelARCMap.IsDeleted;
                     chkIsDeleted.Visible        = true;
                 }
             }
         }
     }
     catch (Exception objException)
     {
         using (db = new LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "lnkEdit_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Get ARC Branches for selected ARC
 /// </summary>
 /// <param name="arcId"></param>
 private void BindArcBranches(int arcId)
 {
     try
     {
         using (db = new LinqToSqlDataContext())
         {
             var arcBranchData = db.AlarmDeliveryARCMappings.Where(x => x.ARCId == arcId); // call sp
             gvArcBranches.DataSource = arcBranchData;
             gvArcBranches.DataBind();
             if (gvArcBranches.Rows.Count == 0)
             {
                 //btnDeleted.Visible = false;
                 string script = "alertify.alert('" + ltrNoMap.Text + "');";
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             }
             else
             {
                 //btnDeleted.Visible = true;
             }
         }
     }
     catch (Exception objException)
     {
         using (db = new LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "BindArcBranches", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         }
     }
 }
    private void LoadTermsAndConditionsLinks()
    {
        string val = string.Empty;

        try
        {
            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                USP_GetTermsAndConditionsResult result = db.USP_GetTermsAndConditions(Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()].ToString())).FirstOrDefault();
                if (result == null)
                {
                    return;
                }
                else
                {
                    lnkTerms.NavigateUrl = result.NavigateURL;
                }
            }
        }
        catch (Exception objException)
        {
            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadARCEmailCC", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
            }
        }
    }
 protected void gvBillingCodes_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         Label lblId      = (Label)gvBillingCodes.Rows[e.RowIndex].FindControl("lblID");
         int   idToDelete = Convert.ToInt32(lblId.Text);
         db = new LinqToSqlDataContext();
         var overrideCodeToDelete = db.OverideBillingCodes.Single(a => a.id == idToDelete);
         if (overrideCodeToDelete != null)
         {
             db.OverideBillingCodes.DeleteOnSubmit(overrideCodeToDelete);
             db.SubmitChanges();
             string script = "alertify.alert('" + ltrDeleteSuccess.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         else
         {
             string script = "alertify.alert('" + ltrDeleteFail.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         BindGrid();
     }
     catch (Exception objException)
     {
         string script = "alertify.alert('" + objException.Message + "');";
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "gvBillingCodes_RowDeleting", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
 private void GetBulkUploadOrderedItems()
 {
     try
     {
         DataSet dsResult = UploadMultipleOrdersBAL.GetBulkUploadOrderItems(Session[enumSessions.User_Name.ToString()].ToString());
         if (dsResult.Tables.Count > 1)
         {
             if (dsResult.Tables[0].Rows.Count > 0)
             {
                 rptBasketItems.DataSource = dsResult.Tables[0];
                 rptBasketItems.DataBind();
                 divBasketItems.Visible = true;
                 btnProceed.Visible     = true;
             }
             else
             {
                 divBasketItems.Visible = false;
             }
         }
     }
     catch (Exception objException)
     {
         using (LinqToSqlDataContext db = new LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "GetBulkUploadOrderedItems", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Name.ToString()]));
         }
     }
 }
Exemple #7
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            Session[enumSessions.UserIdToUpdate.ToString()] = null;
            ChkBoxIsapproved.Checked = false;
            ChkBoxIsBlocked.Checked  = false;
            db = new LinqToSqlDataContext();
            var UserDetails = (from usrDtls in db.VW_GetActiveUsersDetails
                               where usrDtls.UserName.Contains(Txtunamesrch.Text) &&
                               usrDtls.RoleName.Contains(ddrolesrch.SelectedIndex == 0 ? "" : ddrolesrch.SelectedItem.ToString()) &&
                               usrDtls.Email.Contains(Txtuemailsrch.Text) &&
                               usrDtls.ARCId == Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()])
                               select usrDtls);

            gvUsers.DataSource = UserDetails;
            gvUsers.DataBind();

            if (UserDetails.Count() == 0)
            {
                LoadData();
                string script = "alertify.alert('" + ltrNoMatch.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnSearch_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #8
0
    public void LoadData()
    {
        try
        {
            // binding all categories with dropdown
            db = new LinqToSqlDataContext();
            var ctgs = (from ctg in db.Categories
                        where ctg.IsDeleted == false
                        orderby ctg.ListOrder
                        select new { ctg.CategoryId, CategoryDisp = ctg.CategoryName + "[" + ctg.CategoryCode + "] " });


            ddlCategory.DataSource     = ctgs;
            ddlCategory.DataValueField = "CategoryId";
            ddlCategory.DataTextField  = "CategoryDisp";
            ddlCategory.DataBind();
            ddlCategory.Items.Insert(0, new ListItem("-----Select-----", "-1"));

            //binding gvctg in panel products
            db = new LinqToSqlDataContext();
            var ctgdata = (from ctg in db.Categories
                           where ctg.IsDeleted == false
                           orderby ctg.ListOrder
                           select new { ctg.CategoryId, CategoryDisp = ctg.CategoryName + " [" + ctg.CategoryCode + "]" });
            gvctg.DataSource = ctgdata;
            gvctg.DataBind();
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
    protected void btnCSLConnect_Click(object sender, EventArgs e)
    {
        try
        {
            txtpronamesrch.Text = "";
            txtprocodesrch.Text = "";
            db = new LinqToSqlDataContext();
            var cslConnectProducts = (from pro in db.Products
                                      orderby pro.ProductCode ascending
                                      where (pro.ListedonCSLConnect == true) && pro.IsDependentProduct == false
                                      select pro);

            if (cslConnectProducts.Any(x => x != null))
            {
                gvProducts.DataSource = null;
                gvProducts.DataSource = cslConnectProducts;
                gvProducts.DataBind();
                Session[enumSessions.ListedonCSLConnect.ToString()] = "1";
            }
            else
            {
                gvProducts.DataSource = null;
                gvProducts.DataSource = cslConnectProducts;
                gvProducts.DataBind();
                string script = "alertify.alert('" + ltrNoMatch.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnCSLConnect_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #10
0
    protected void rptInstallerCompanies_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            db = new LinqToSqlDataContext();
            Session[enumSessions.SelectedInstaller.ToString()]  = e.CommandName;
            Session[enumSessions.InstallerCompanyID.ToString()] = e.CommandArgument;
            Guid instCompId = new Guid(e.CommandArgument.ToString());

            var installerDetail = (from inst in db.Installers
                                   where inst.InstallerCompanyID == instCompId
                                   select inst).FirstOrDefault();
            var installerAddress = (from addr in db.InstallerAddresses
                                    where addr.AddressID == installerDetail.AddressID
                                    select addr).FirstOrDefault();
            string installer = "<br/><strong>" + installerDetail.CompanyName.ToString() + "</strong><br/>" + installerDetail.Accreditation + ", CSL Code: " + installerDetail.UniqueCode + "<br/>" +
                               installerAddress.AddressOne + ", " + installerAddress.AddressTwo + "<br/>" + installerAddress.Town + ", " + installerAddress.County + "<br/>" +
                               installerAddress.PostCode + "<br/>" + installerAddress.Country;
            Clear();
            lblInstaller.Text = "Selected Installer: " + installer;
        }
        catch (System.Threading.ThreadAbortException ex)
        {
            //
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), ((System.Reflection.MemberInfo)(objException.TargetSite)).Name, Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #11
0
    protected void gvOrders_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int    OrderId        = 0;
            string sortingCommand = Convert.ToString(e.CommandArgument);
            if (e.CommandName == "Select")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvOrders.Rows[index];

                OrderId = Convert.ToInt32(gvOrders.DataKeys[index].Value.ToString());

                Session[enumSessions.PreviousOrderId.ToString()] = OrderId;
                LoadOrderDetails();
                LoadBasketProducts();
            }
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "gvOrders_RowCommand", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #12
0
    protected void BindControls()
    {
        db = new LinqToSqlDataContext();
        try
        {
            List <ApplicationSetting> appsettingList = new List <ApplicationSetting>();
            appsettingList = (from a in db.ApplicationSettings
                              select a
                              ).ToList();

            ddlAppSetting.DataSource     = appsettingList;
            ddlAppSetting.DataTextField  = "KeyName";
            ddlAppSetting.DataValueField = "KeyName";
            ddlAppSetting.DataBind();
            foreach (var p in appsettingList)
            {
                if (p.KeyName == ddlAppSetting.SelectedValue)
                {
                    txtAppSetting.Text = p.KeyValue;
                }
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "Manage AppSetting ->Page_Load", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
        finally
        {
            if (db != null)
            {
                db.Dispose();
            }
        }
    }
 protected void gvBillingCodes_RowEditing(object sender, GridViewEditEventArgs e)
 {
     try
     {
         Label lblCompanyName  = (Label)gvBillingCodes.Rows[e.NewEditIndex].FindControl("lblCompanyName");
         Label lblOriginalCode = (Label)gvBillingCodes.Rows[e.NewEditIndex].FindControl("lblOriginalCode");
         Label lblOverrideCode = (Label)gvBillingCodes.Rows[e.NewEditIndex].FindControl("lblOverrideCode");
         Label lblId           = (Label)gvBillingCodes.Rows[e.NewEditIndex].FindControl("lblID");
         gvBillingCodes.EditIndex = e.NewEditIndex;
         id = Convert.ToInt32(lblId.Text);
         BindGrid();
         TextBox txtCompanyName = (TextBox)gvBillingCodes.Rows[gvBillingCodes.EditIndex].FindControl("txtCompanyName");
         txtCompanyName.Text = lblCompanyName.Text;
         TextBox txtOriginalcode = (TextBox)gvBillingCodes.Rows[gvBillingCodes.EditIndex].FindControl("txtOriginalCode");
         txtOriginalcode.Text = lblOriginalCode.Text;
         TextBox txtOverrideCode = (TextBox)gvBillingCodes.Rows[gvBillingCodes.EditIndex].FindControl("txtOverrideCode");
         txtOverrideCode.Text = lblOverrideCode.Text;
     }
     catch (Exception objException)
     {
         string script = "alertify.alert('" + objException.Message + "');";
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "gvBillingCodes_RowEditing", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
Exemple #14
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            db = new LinqToSqlDataContext();
            var searchbyname = (from cats in db.Categories
                                where cats.IsDeleted == false &&
                                (cats.CategoryName.Contains(txtctgnamesrch.Text.Trim()) && cats.CategoryCode.Contains(txtctgcodesrch.Text.Trim()))
                                select cats);

            if (searchbyname.Count() != 0)
            {
                gvCategories.DataSource = searchbyname;
                gvCategories.DataBind();
            }
            else
            {
                LoadData();
            }

            ClearAllInputs();

            //uncheck arcs
            for (int i = 0; i <= CheckBoxARC.Items.Count - 1; i++)
            {
                CheckBoxARC.Items[i].Selected = false;
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnSearch_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName());
        }
    }
    protected void btnProceed_Click(object sender, EventArgs e)
    {
        int resultVal = 0;

        try
        {
            if (rptUploadedProducts.Items.Count > 0)
            {
                int    ARC_Id             = Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()].ToString());
                int    OrderId            = Convert.ToInt32(Session[enumSessions.OrderId.ToString()].ToString());
                bool   IsARC_AllowReturns = Convert.ToBoolean(Session[enumSessions.IsARC_AllowReturns.ToString()].ToString());
                string UserId             = Convert.ToString(Session[enumSessions.User_Id.ToString()].ToString());
                string userName           = Session[enumSessions.User_Name.ToString()].ToString();
                resultVal = UploadOrderBAL.UploadOrderItems(ARC_Id, OrderId, IsARC_AllowReturns, userName, UserId);
                Response.Redirect("Basket.aspx");
            }
            else
            {
                string script = "alertify.alert('" + ltrUpload.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
        }
        catch (Exception objException)
        {
            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                db.USP_SaveErrorDetails(Request.Url.ToString(), "btnProceed_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
            }
        }
    }
    protected void btnAddNew_Click(object sender, EventArgs e)
    {
        try
        {
            db = new LinqToSqlDataContext();
            var overideBillingCode = from a in db.OverideBillingCodes
                                     select a;
            DataTable dt1 = new DataTable();
            dt1.Columns.Add("id");
            dt1.Columns.Add("CompanyName");
            dt1.Columns.Add("OriginalCode");
            dt1.Columns.Add("OverideCode");


            foreach (var item in overideBillingCode)
            {
                dt1.Rows.Add(item.id, item.CompanyName, item.OriginalCode, item.OverideCode);
            }
            DataRow dr = dt1.NewRow();
            dt1.Rows.InsertAt(dr, 0);
            gvBillingCodes.EditIndex  = 0;
            gvBillingCodes.DataSource = dt1;
            gvBillingCodes.DataBind();
            LinkButton lkupdate = gvBillingCodes.Rows[0].FindControl("lnkUpdate") as LinkButton;
            lkupdate.Text = "Insert";
        }
        catch (Exception objException)
        {
            string script = "alertify.alert('" + objException.Message + "');";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnAddNew_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #17
0
    public void LoadData()
    {
        try
        {
            btnSave.Visible       = false;
            divcreateuser.Visible = false;
            Session[enumSessions.UserIdToUpdate.ToString()] = null;
            MaintainScrollPositionOnPostBack = true;
            txtuname.Text            = "";
            Txtunamesrch.Text        = "";
            Txtuemail.Text           = "";
            txtpwd.Text              = "";
            txtConfirmPwd.Text       = "";
            txtAnswer.Text           = "";
            ddrolesrch.SelectedIndex = 0;
            txtuname.Enabled         = true;
            ChkBoxIsapproved.Checked = false;
            ChkBoxIsBlocked.Checked  = false;
            ChkBoxIsBlocked.Enabled  = false;

            //binding griduser
            db = new LinqToSqlDataContext();

            var UserDetails = (from usrDtls in db.VW_GetActiveUsersDetails
                               where usrDtls.UserId == Guid.Parse(Session[enumSessions.User_Id.ToString()].ToString())
                               orderby usrDtls.CompanyName ascending
                               select usrDtls);
            pnlManager.Visible = pnlSearch.Visible = false;

            if (Session[enumSessions.User_Role.ToString()].ToString() == enumRoles.ARC_Manager.ToString())
            {
                UserDetails = (from usrDtls in db.VW_GetActiveUsersDetails
                               where usrDtls.ARCId == Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()])
                               orderby usrDtls.CompanyName ascending
                               select usrDtls);
                pnlManager.Visible = pnlSearch.Visible = true;
            }


            gvUsers.DataSource = UserDetails;
            gvUsers.DataBind();

            ListItem li = new ListItem();
            li.Text  = "All";
            li.Value = "-1";
            ddrolesrch.Items.Insert(0, li);
            ddrolesrch.SelectedIndex = 0;

            for (int i = 0; i <= Chkboxroles.Items.Count - 1; i++)
            {
                Chkboxroles.Items[i].Selected = false;
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #18
0
 protected void btnAddNewPriceBand_Click(object sender, EventArgs e)
 {
     try
     {
         int retrun = -1;
         if (txtNewPriceBand.Text.Length > 100)
         {
             string script = "alertify.alert('" + ltrBandNameLength.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             return;
         }
         db = new LinqToSqlDataContext();
         Int32 objCurrencyId = Convert.ToInt32(ddlCurrency.SelectedValue);
         var   validate      = (from p in db.PriceBands
                                join pbn in db.BandNameMasters on p.BandNameId equals pbn.ID
                                where pbn.BandName == txtNewPriceBand.Text && p.CurrencyID == objCurrencyId
                                select p).Count();
         if (validate == 0)
         {
             db = new LinqToSqlDataContext();
             var prods = (from prod in db.Products
                          where prod.ListedonCSLConnect == true
                          select prod).ToList();
             foreach (var p in prods)
             {
                 retrun = db.USP_CreatePriceBands(txtNewPriceBand.Text.ToUpper(), p.ProductId, objCurrencyId, p.Price, p.AnnualPrice, Convert.ToString(Session[enumSessions.User_Id.ToString()])); // pass all values to save
             }
             txtNewPriceBand.Visible       = false;
             txtNewPriceBand.Text          = String.Empty;
             ddlPriceBand.Visible          = true;
             btnNewPriceBand.Visible       = true;
             btnCancelNewPriceBand.Visible = false;
             btnAddNewPriceBand.Visible    = false;
             if (retrun == 0)
             {
                 string script = "alertify.alert('" + ltrBandCreated.Text + "');";
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             }
             else
             {
                 string script = "alertify.alert('" + ltrBandNotCreated.Text + "');";
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             }
             BindPriceBandDropdown();
         }
         else
         {
             string script = "alertify.alert('" + ltrBandExists.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             return;
         }
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "gvProducts_PageIndexChanging", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
Exemple #19
0
    public void CheckProd()
    {
        try
        {
            int CtgID = Convert.ToInt32(Session[enumSessions.CategoryId.ToString()]);
            //uncheck all first
            foreach (GridViewRow ctgrow in gvctg.Rows)
            {
                if (ctgrow.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkctg = ctgrow.FindControl("chkctg") as CheckBox;
                    chkctg.Checked = false;
                    GridView innergrid = ctgrow.FindControl("gvinner") as GridView;
                    foreach (GridViewRow prodrow in innergrid.Rows)
                    {
                        if (prodrow.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkpro = prodrow.FindControl("chkprod") as CheckBox;
                            chkpro.Checked = false;
                        }
                    }
                }
            }

            int Prod_Id = 0;
            db = new LinqToSqlDataContext();
            var Ctg_prods = (from pr in db.Products
                             join ctg in db.Category_Product_Maps
                             on pr.ProductId equals ctg.ProductId
                             where ctg.CategoryId == CtgID
                             select new { pr.ProductName, pr.ProductCode, pr.ProductId });

            foreach (var objp in Ctg_prods)
            {
                Prod_Id = Convert.ToInt32(objp.ProductId);
                foreach (GridViewRow ctgrow in gvctg.Rows)
                {
                    GridView innergrid = ctgrow.FindControl("gvinner") as GridView;
                    foreach (GridViewRow prodrow in innergrid.Rows)
                    {
                        int chkProdid = int.Parse(innergrid.DataKeys[prodrow.RowIndex].Value.ToString());
                        if (chkProdid == Prod_Id)
                        {
                            CheckBox chkpro = prodrow.FindControl("chkprod") as CheckBox;
                            chkpro.Checked = true;
                            chkprod_CheckedChanged(chkpro, null);
                        }
                    }
                }
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "CheckProd", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            Session[enumSessions.ListedonCSLConnect.ToString()] = "0";
            db = new LinqToSqlDataContext();
            var searchbyname = (from pro in db.Products
                                orderby pro.ProductCode ascending
                                where (pro.ProductName.Contains(txtpronamesrch.Text.Trim()) && pro.ProductCode.Contains(txtprocodesrch.Text.Trim()))
                                select pro);

            if (chkM2MSearch.Checked == true)
            {
                searchbyname = (from pro in db.Products
                                orderby pro.ProductCode ascending
                                where (pro.ProductName.Contains(txtpronamesrch.Text.Trim()) && pro.ProductCode.Contains(txtprocodesrch.Text.Trim()) && pro.ListedonCSLConnect == true)
                                select pro);
            }

            if (searchbyname.Any(x => x != null))
            {
                gvProducts.DataSource = null;
                gvProducts.DataSource = searchbyname;
                gvProducts.DataBind();
            }
            else
            {
                gvProducts.DataSource = null;
                gvProducts.DataSource = searchbyname;
                gvProducts.DataBind();
                string script = "alertify.alert('" + ltrNoMatch.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
            //ClearAllInputs();

            //uncheck arcs
            for (int i = 0; i <= lstboxARC.Items.Count - 1; i++)
            {
                lstboxARC.Items[i].Selected = false;
            }

            //uncheck arcs
            for (int i = 0; i <= lstboxInstaller.Items.Count - 1; i++)
            {
                lstboxInstaller.Items[i].Selected = false;
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "btnSearch_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #21
0
 /// <summary>
 /// The purpose of this method to delete the selected ARC branches.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDeleted_Click(object sender, EventArgs e)
 {
     try
     {
         db = new LinqToSqlDataContext();
         int  alarmDelArcId    = 0;
         bool isDeletedRecords = false;
         foreach (GridViewRow row in gvArcBranches.Rows)
         {
             alarmDelArcId = Convert.ToInt32(gvArcBranches.DataKeys[row.RowIndex].Value.ToString());
             if (!String.IsNullOrEmpty((row.FindControl("ARCId") as Label).Text))
             {
                 Int32   arcId     = Convert.ToInt32((row.FindControl("ARCId") as Label).Text);
                 Boolean isDeleted = (row.FindControl("chkDelete") as CheckBox).Checked;
                 if (isDeleted == true)
                 {
                     var alarmDelARCMapping = (from p in db.AlarmDeliveryARCMappings where p.ID == alarmDelArcId && p.ARCId == Convert.ToInt32(ddlArc.SelectedValue.ToString()) select p).Single();
                     alarmDelARCMapping.IsDeleted  = true;
                     alarmDelARCMapping.ModifiedOn = DateTime.Now;
                     alarmDelARCMapping.ModifiedBy = Session[enumSessions.User_Id.ToString()].ToString();
                     db.SubmitChanges();
                     isDeletedRecords = true;
                 }
             }
         }
         if (isDeletedRecords)
         {
             string script = "alertify.alert('" + ltrArcBranchDeleted.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         else
         {
             string script = "alertify.alert('" + ltrNoSelectedToDelete.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         BindArcBranches(Convert.ToInt32(ddlArc.SelectedValue.ToString())); // bind grid after delete ARC price
     }
     catch (Exception objException)
     {
         using (db = new LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "btnDeleted_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         }
     }
     finally
     {
         if (db != null)
         {
             db.Dispose();
         }
     }
 }
 protected void btnShowAll_Click(object sender, EventArgs e)
 {
     try
     {
         txtoptsrch.Text = "";
         LoadData();
     }
     catch (Exception objException)
     {
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "btnShowAll_Click", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
    protected void gvBillingCodes_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridViewRow row             = gvBillingCodes.Rows[e.RowIndex];
            LinkButton  lkupdt          = gvBillingCodes.Rows[e.RowIndex].FindControl("lnkUpdate") as LinkButton;
            TextBox     txtCompanyName  = (TextBox)row.FindControl("txtCompanyName");
            TextBox     txtOriginalCode = (TextBox)row.FindControl("txtOriginalCode");
            TextBox     txtOverrideCode = (TextBox)row.FindControl("txtOverrideCode");
            if (lkupdt.Text == "Insert")
            {
                db = new LinqToSqlDataContext();

                OverideBillingCode billingCode = new OverideBillingCode();

                billingCode.CompanyName  = txtCompanyName.Text;
                billingCode.OriginalCode = Convert.ToInt32(txtOriginalCode.Text);
                billingCode.OverideCode  = Convert.ToInt32(txtOverrideCode.Text);
                db.OverideBillingCodes.InsertOnSubmit(billingCode);
                db.SubmitChanges();
                string script = "alertify.alert('" + ltrInsertSuccess.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
            else
            {
                string companyName  = txtCompanyName.Text;
                int    originalCode = Convert.ToInt32(txtOriginalCode.Text);
                int    overrideCode = Convert.ToInt32(txtOverrideCode.Text);

                db = new LinqToSqlDataContext();

                var overrideData = db.OverideBillingCodes.Single(a => a.id == id);
                overrideData.CompanyName  = companyName;
                overrideData.OriginalCode = originalCode;
                overrideData.OverideCode  = overrideCode;
                db.SubmitChanges();
                string script = "alertify.alert('" + ltrUpdateSuccess.Text + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
            gvBillingCodes.EditIndex = -1;
            BindGrid();
        }
        catch (Exception objException)
        {
            string script = "alertify.alert('" + objException.Message + "');";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "gvBillingCodes_RowUpdating", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #24
0
    public void LoadData()
    {
        ClearAllInputs();
        try
        {
            //binding all categories in category grid

            db = new LinqToSqlDataContext();
            var ctgs = (from cats in db.Categories
                        orderby cats.CategoryName ascending
                        where cats.CategoryName.Contains(txtctgnamesrch.Text.Trim()) &&
                        cats.CategoryCode.Contains(txtctgcodesrch.Text.Trim())
                        select cats);
            gvCategories.DataSource = ctgs;
            gvCategories.DataBind();

            //binding gvctg in panel products

            db = new LinqToSqlDataContext();
            var ctgdata = (from ctg in db.Categories
                           where ctg.IsDeleted == false
                           orderby ctg.ListOrder
                           select new { ctg.CategoryId, CategoryDisp = ctg.CategoryName + " [" + ctg.CategoryCode + "]" });
            gvctg.DataSource = ctgdata;
            gvctg.DataBind();

            // binding all ARC's with checkboxes

            db = new LinqToSqlDataContext();
            var ARCdata = (from arc in db.ARCs
                           where arc.IsDeleted == false
                           orderby arc.CompanyName
                           select new { arc.ARCId, ARCDisp = arc.CompanyName + " - [" + arc.ARC_Code + "]  " });

            CheckBoxARC.DataValueField = "ARCId";
            CheckBoxARC.DataTextField  = "ARCDisp";
            CheckBoxARC.DataSource     = ARCdata;
            CheckBoxARC.DataBind();
            CheckBoxARC.Items.Insert(0, "Select All");
            for (int i = 0; i <= CheckBoxARC.Items.Count - 1; i++)
            {
                CheckBoxARC.Items[i].Selected = false;
            }
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
    }
Exemple #25
0
 protected void gvUsers_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         gvUsers.PageIndex = e.NewPageIndex;
         LoadData();
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "gvUsers_PageIndexChanging", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
    protected void BindControls()
    {
        db = new LinqToSqlDataContext();
        try
        {
            var arcProductIds       = (from pam in db.Product_ARC_Maps select pam.ProductId).Distinct();
            var installerProductIds = (from pam in db.Product_ARC_Maps select pam.ProductId).Distinct();
            var productCodesFrom    = (from product in db.Products
                                       where product.IsDeleted == false && product.ProductCode != null && (arcProductIds.Contains(product.ProductId) || installerProductIds.Contains(product.ProductId))
                                       orderby product.ProductCode ascending
                                       select new
            {
                productID = product.ProductId,
                productName = product.ProductName,
                productDisp = product.ProductCode
            }).ToList();

            lstProductsFrom.DataSource     = productCodesFrom;
            lstProductsFrom.DataTextField  = "productDisp";
            lstProductsFrom.DataValueField = "productName";
            lstProductsFrom.DataBind();

            var productCodesTo = (from product in db.Products
                                  where product.IsDeleted == false && product.ProductCode != null
                                  orderby product.ProductCode ascending
                                  select new
            {
                productID = product.ProductId,
                productName = product.ProductName,
                productDisp = product.ProductCode
            }).ToList();
            lstProductsTo.DataSource     = productCodesTo;
            lstProductsTo.DataTextField  = "productDisp";
            lstProductsTo.DataValueField = "productName";
            lstProductsTo.DataBind();
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "MappingInstallerARCToProducts-->PageLoad", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
        }
        finally
        {
            if (db != null)
            {
                db.Dispose();
            }
        }
    }
Exemple #27
0
 protected void gvArcBranches_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         gvArcBranches.PageIndex = e.NewPageIndex;
         BindArcBranches(Convert.ToInt32(ddlArc.SelectedValue.ToString()));
     }
     catch (Exception objException)
     {
         using (db = new LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "gvArcBranches_PageIndexChanging", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             BindARCDropdown();
         }
     }
     catch (Exception objException)
     {
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "Page_Load", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
     }
 }
Exemple #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             LoadData();
             Session[enumSessions.CategoryId.ToString()] = null;
         }
         catch (Exception objException)
         {
             db = new CSLOrderingARCBAL.LinqToSqlDataContext();
             db.USP_SaveErrorDetails(Request.Url.ToString(), "Page_Load", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName());
         }
     }
 }
Exemple #30
0
 protected void ddlArc_SelectedIndexChanges(object sender, EventArgs e)
 {
     try
     {
         hdnAlarmDelARCMapId.Value = "0";
         if (ddlArc.SelectedIndex > 0)
         {
             BindArcBranches(Convert.ToInt32(ddlArc.SelectedValue.ToString()));
             btnSave.Visible = true;
         }
         else
         {
             string script = "alertify.alert('" + ltrSelectARC.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
             btnSave.Visible = false;
             //btnDeleted.Visible = false;
             gvArcBranches.DataSource = null;
             gvArcBranches.DataBind();
             return;
         }
         if (gvArcBranches.Rows.Count > 0)
         {
             btnSave.Visible = true;
             //btnDeleted.Visible = true;
         }
         else
         {
             //btnSave.Visible = false;
             //btnDeleted.Visible = false;
         }
     }
     catch (Exception objException)
     {
         using (db = new CSLOrderingARCBAL.LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "ddlArc_SelectedIndexChanges", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, Convert.ToString(HttpContext.Current.Session[enumSessions.User_Id.ToString()]));
         }
     }
     finally
     {
         if (db != null)
         {
             db.Dispose();
         }
     }
 }