Пример #1
0
    protected void LinkButtonupdate_click(object sender, System.EventArgs e)
    {
        CSLOrderingARCBAL.LinqToSqlDataContext db = null;
        try
        {
            pnlGradeDetails.Visible = true;
            pnlGradeList.Visible    = false;
            litAction.Text          = "You choose to <b>EDIT GRADE MAPPING</b>";
            LinkButton lbctg = sender as LinkButton;
            if (lbctg != null)
            {
                GridViewRow gvr  = (GridViewRow)lbctg.NamingContainer;
                Label       lbl1 = gvr.FindControl("lblProductGradeID") as Label;
                ViewState["ProductGradeID"] = lbl1.Text;
            }

            db = new LinqToSqlDataContext();
            var usrDtls = ProductBAL.GetProductGradeById(Convert.ToInt32(ViewState["ProductGradeID"].ToString()));


            if (usrDtls != null)
            {
                txtProductCode.Text    = usrDtls.ProductCode;
                ddlGrade.SelectedValue = usrDtls.Grade.ToString();
            }

            db.Dispose();
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "LinkButtonupdate_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()]));
            db.Dispose();
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session[enumSessions.User_Id.ToString()] == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                LoadCategories();
            }
        }
        catch (System.Threading.ThreadAbortException)
        {
            // ** Do Nothing
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            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()]));
            db.Dispose();
        }
    }
Пример #3
0
    protected void ddlDeliveryTypes_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            int deliTypeID = 0;
            int.TryParse(ddlDeliveryTypes.SelectedValue, out deliTypeID);
            if (deliTypeID != 0)
            {
                lblDeliveryTotal.Text     = OrdersBAL.CalculateOrderDeliverycharge(deliTypeID).ToString();
                lblDtlsDeliveryTotal.Text = lblDeliveryTotal.Text;

                decimal amt = Convert.ToDecimal(String.IsNullOrEmpty(lblDtlsOrderTotal.Text) == true ? "0.00" : lblDtlsOrderTotal.Text) + Convert.ToDecimal(lblDtlsDeliveryTotal.Text);
                decimal?VAT = amt * VATRate;

                lblDtlsVAT.Text        = Math.Round(Convert.ToDecimal(VAT), 2).ToString();
                lblDtlsTotalToPay.Text = (amt + Math.Round(Convert.ToDecimal(VAT), 2)).ToString();
            }
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "ddlDeliveryTypes_SelectedIndexChanged", 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()]));
            db.Dispose();
        }
    }
    private async Task <bool> AddasNewUser(string access_token, Guid OrderingUserId, StringContent Jsoncontent)
    {
        HttpResponseMessage response = new HttpResponseMessage();
        Guid?KeyCloakUserID;

        try
        {
            using (var client = new HttpClient())
            {
                var url = KCConfiguration.KCCreateUserURL;
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + access_token);
                response = await client.PostAsync(url, Jsoncontent);
            }
            if (response.IsSuccessStatusCode)
            {
                KeyCloakUserID = new Guid(response.Headers.Location.Segments[Convert.ToInt32(KCConfiguration.KCUserIdSegmentNo)]);
                AuditCreationofUser(OrderingUserId, KeyCloakUserID);
            }
            else
            {
                LogIssue("AddasNewUser", response.ReasonPhrase + OrderingUserId.ToString(), OrderingUserId.ToString());
            }
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails("Authentication Service", "AddasNewUser" + OrderingUserId.ToString(), Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", "", false, response.Headers.Location.Segments.ToString());
        }
        return(true);
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Response.Cache.SetExpires(DateTime.UtcNow.AddMilliseconds(-1));
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();


            cslLogin.Focus();
            lblMsg.Text = "";
        }
        catch (System.Threading.ThreadAbortException ex)
        {
            //
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            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()]));
        }

        cslLogin.LoggedIn += cslLogin_LoggedIn;
    }
    private async Task <bool> UpdateExistingUser(string access_token, Guid OrderingUserId, String KeyCloakUserId, StringContent Jsoncontent)
    {
        HttpResponseMessage response;

        try
        {
            using (var client = new HttpClient())
            {
                var url = KCConfiguration.KCCreateUserURL + "/" + KeyCloakUserId;
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + access_token);
                response = await client.PutAsync(url, Jsoncontent);
            }
            if (!response.IsSuccessStatusCode)
            {
                LogIssue("UpdateExistingUser", response.ReasonPhrase, OrderingUserId.ToString());
            }
            else
            {
                AuditUpdateofUser(OrderingUserId, new Guid(KeyCloakUserId));
            }
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails("Authentication Service", "UpdateExistingUser" + OrderingUserId.ToString(), Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", "", false, OrderingUserId.ToString());
        }
        return(true);
    }
Пример #7
0
    DataSet ReadCSV(string fileNameToUpload)
    {
        DataSet ds = new DataSet();

        System.Data.OleDb.OleDbConnection excelConnection = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("UploadedOrders") + ";Extended Properties=Text;");

        try
        {
            System.Data.OleDb.OleDbCommand     excelCommand = new System.Data.OleDb.OleDbCommand(@"SELECT * FROM " + fileNameToUpload, excelConnection);
            System.Data.OleDb.OleDbDataAdapter excelAdapter = new System.Data.OleDb.OleDbDataAdapter(excelCommand);
            excelConnection.Open();
            excelAdapter.Fill(ds);
            excelConnection.Close();
        }
        catch (Exception objException)
        {
            if (objException != null && objException.Message != null)
            {
                string script = "alertify.alert('" + objException.Message + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }

            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "ReadCSV", 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
        {
            excelConnection.Close();
        }
        return(ds);
    }
Пример #8
0
 private void LoadInstaller()
 {
     try
     {
         if (Session[enumSessions.InstallerCompanyID.ToString()] != null && Session[enumSessions.OrderId.ToString()] != null)
         {
             LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
             dataCtxt.USP_SaveInstallerDetailsInOrder(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), Convert.ToInt32(Session[enumSessions.OrderId.ToString()]));
             dataCtxt.Dispose();
         }
         else
         {
             Response.Redirect("SelectInstaller.aspx");
         }
     }
     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()]));
     }
 }
Пример #9
0
        public static List <OrderItemDetailsDTO> GetOrderDetailsforReport(int orderID)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db = null;
            try
            {
                db = new CSLOrderingARCBAL.LinqToSqlDataContext();
                List <OrderItemDetailsDTO> orderItemDetails = new List <OrderItemDetailsDTO>();
                orderItemDetails =

                    (from o in db.Orders
                     join oi in db.OrderItems on o.OrderId equals oi.OrderId
                     join oid in db.OrderItemDetails on oi.OrderItemId equals oid.OrderItemId
                     join ois in db.OrderStatusMasters on oi.OrderItemStatusId equals ois.OrderStatusId
                     join op in db.Options on oid.OptionId equals op.OptID into x
                     from Y in x.DefaultIfEmpty()
                     select new OrderItemDetailsDTO
                {
                    GPRSNo = oid.GPRSNo,
                    PSTNNo = oid.PSTNNo,
                    GSMNo = oid.GSMNo,
                    LANNo = oid.LANNo,
                    GPRSNoPostCode = oid.GPRSNoPostCode,
                    ICCID = oid.ICCID,
                    OrderItemStatus = ois.OrderStatus,
                    OptionName = (Y == null ? String.Empty : Y.OptionName)
                }).ToList <OrderItemDetailsDTO>();;



                //    (from o in db.Orders
                //                    join oi in db.OrderItems on o.OrderId equals oi.OrderId
                //                    join oid in db.OrderItemDetails on oi.OrderItemId equals oid.OrderItemId
                //                    join op in db.Options on oid.OptionId equals op.OptID
                //                    join ois in db.OrderStatusMasters on oi.OrderItemStatusId equals ois.OrderStatusId
                //                    where oi.OrderItemId == orderID && oid.GPRSNo !=String.Empty
                //                    select new OrderItemDetailsDTO
                //                    {

                //                        GPRSNo =   oid.GPRSNo,
                //                        PSTNNo = oid.PSTNNo,
                //                        GSMNo = oid.GSMNo,
                //                        LANNo = oid.LANNo,
                //                        GPRSNoPostCode = oid.GPRSNoPostCode,
                //                        ICCID = oid.ICCID,
                //                        OrderItemStatus = ois.OrderStatus,
                //                        OptionName = op.OptionName



                //                    }).ToList<OrderItemDetailsDTO>();
                db.Dispose();
                return(orderItemDetails);
            }
            catch (Exception objException)
            {
                db = new CSLOrderingARCBAL.LinqToSqlDataContext();
                db.USP_SaveErrorDetails("ARC Ordering", "GetOrderDetailsforReport", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, null);
                return(null);
            }
        }
Пример #10
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
         string installerName          = installerCompanyName.Text.Trim().ToLower();
         string postCode = txtPostCode.Text.Trim().ToLower();
         List <GetInstallersByNameOrPostCodeResult> installerQry = dataCtxt.GetInstallersByNameOrPostCode(installerName, postCode, Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()])).ToList();
         var listCount = installerQry.Count();
         if (listCount > 0)
         {
             rptInstallerCompanies.DataSource = installerQry;
             rptInstallerCompanies.DataBind();
             lblErrorMessage.Text = string.Empty;
         }
         else
         {
             rptInstallerCompanies.DataSource = null;
             rptInstallerCompanies.DataBind();
             string script = "alertify.alert('" + ltrNoMatch.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
         AjaxControlToolkit.ModalPopupExtender mpInstaller = Parent.FindControl("mpInstaller") as AjaxControlToolkit.ModalPopupExtender;
         if (mpInstaller != null)
         {
             mpInstaller.Show();
         }
     }
     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()]));
     }
 }
Пример #11
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;
            }
        }
    }
Пример #12
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;
        }
    }
Пример #13
0
 protected void Select_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddlInstallers.SelectedIndex > -1)
         {
             Session[enumSessions.SelectedInstaller.ToString()]  = ddlInstallers.SelectedItem.Text;
             Session[enumSessions.InstallerCompanyID.ToString()] = ddlInstallers.SelectedValue.ToString();
             LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
             if (Session[enumSessions.BulkUploadMultipleOrderId.ToString()] != null)
             {
                 int addressId = 0;
                 dataCtxt.USP_SaveInstallerDetailsInOrder(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), Convert.ToInt32(Session[enumSessions.BulkUploadMultipleOrderId.ToString()]));
                 var insContactName = (from insAdd in dataCtxt.InstallerAddresses
                                       join ins in dataCtxt.Installers on insAdd.AddressID equals ins.AddressID
                                       where ins.InstallerCompanyID == new Guid(Session[enumSessions.InstallerCompanyID.ToString()].ToString())
                                       select insAdd.ContactName).Single();
                 if (insContactName != null)
                 {
                     addressId = InstallerBAL.SaveInstallerAddress(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), insContactName, "", 0, "", "", "", "", "", "", Session[enumSessions.User_Name.ToString()].ToString());
                 }
                 var orderDetail = dataCtxt.Orders.Single(x => x.OrderId == Convert.ToInt32(Session[enumSessions.BulkUploadMultipleOrderId.ToString()]));
                 if (orderDetail.DeliveryAddressId == 0)
                 {
                     orderDetail.DeliveryAddressId = addressId;
                 }
                 orderDetail.ModifiedBy = Session[enumSessions.User_Name.ToString()].ToString();
                 orderDetail.ModifiedOn = DateTime.Now;
                 dataCtxt.SubmitChanges();
                 getBulkuploadOrderItems(e);
                 // Session[enumSessions.BulkUploadMultipleOrderId.ToString()] = null;
                 AjaxControlToolkit.ModalPopupExtender mpInstaller = Parent.FindControl("mpInstaller") as AjaxControlToolkit.ModalPopupExtender;
                 mpInstaller.Hide();
             }
             else
             {
                 dataCtxt.USP_SaveInstallerDetailsInOrder(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), Convert.ToInt32(Session[enumSessions.OrderId.ToString()]));
                 dataCtxt.Dispose();
                 Response.Redirect("Checkout.aspx");
             }
         }
         else
         {
             string script = "alertify.alert('" + ltrSelect.Text + "');";
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
         }
     }
     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()]));
     }
 }
Пример #14
0
 private void LogIssue(String Title, String FailureReason, String ReferenceString)
 {
     try {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails("Authentication Service", Title, FailureReason, "", "", "", "", false, ReferenceString);
     }
     catch (Exception) { }
 }
Пример #15
0
 protected void rptInstallerCompanies_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         Session[enumSessions.SelectedInstaller.ToString()]  = e.CommandName;
         Session[enumSessions.InstallerCompanyID.ToString()] = e.CommandArgument;
         Session["selectInstaller"] = "selected";
         LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();
         if (Session[enumSessions.BulkUploadMultipleOrderId.ToString()] != null)
         {
             int addressId = 0;
             dataCtxt.USP_SaveInstallerDetailsInOrder(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), Convert.ToInt32(Session[enumSessions.BulkUploadMultipleOrderId.ToString()]));
             var insContactName = (from insAdd in dataCtxt.InstallerAddresses
                                   join ins in dataCtxt.Installers on insAdd.AddressID equals ins.AddressID
                                   where ins.InstallerCompanyID == new Guid(Session[enumSessions.InstallerCompanyID.ToString()].ToString())
                                   select insAdd.ContactName).Single();
             if (insContactName != null)
             {
                 addressId = InstallerBAL.SaveInstallerAddress(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), insContactName, "", 0, "", "", "", "", "", "", Session[enumSessions.User_Name.ToString()].ToString());
             }
             var orderDetail = dataCtxt.Orders.Single(x => x.OrderId == Convert.ToInt32(Session[enumSessions.BulkUploadMultipleOrderId.ToString()]));
             if (orderDetail.DeliveryAddressId == 0)
             {
                 orderDetail.DeliveryAddressId = addressId;
             }
             orderDetail.ModifiedBy = Session[enumSessions.User_Name.ToString()].ToString();
             orderDetail.ModifiedOn = DateTime.Now;
             dataCtxt.SubmitChanges();
             getBulkuploadOrderItems(e);
             // Session[enumSessions.BulkUploadMultipleOrderId.ToString()] = null;
             AjaxControlToolkit.ModalPopupExtender mpInstaller = Parent.FindControl("mpInstaller") as AjaxControlToolkit.ModalPopupExtender;
             mpInstaller.Hide();
         }
         else
         {
             dataCtxt.USP_SaveInstallerDetailsInOrder(Session[enumSessions.InstallerCompanyID.ToString()].ToString(), Convert.ToInt32(Session[enumSessions.OrderId.ToString()]));
             dataCtxt.Dispose();
             Response.Redirect("Checkout.aspx");
         }
     }
     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()]));
     }
 }
Пример #16
0
 protected void gvDistributors_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         gvDistributors.PageIndex = e.NewPageIndex;
         LoadDistributerList();
         BindDistributerGrid();
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "gvDistributors_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()]));
     }
 }
Пример #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session[enumSessions.User_Id.ToString()] == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (Request.QueryString["CategoryId"] != null)
            {
                this.CategoryID = Convert.ToInt32(Request.QueryString["CategoryId"]);
                if (CategoryID == 0)
                {
                    Response.Redirect("Categories.aspx");
                }
            }

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["CategoryId"] != null)
                {
                    this.CategoryID = Convert.ToInt32(Request.QueryString["CategoryId"]);
                    if (CategoryID == 0)
                    {
                        Response.Redirect("Categories.aspx");
                    }

                    LoadProductDetails();

                    Category objCategory = CategoryBAL.GetCategory(CategoryID);
                    Page.Title           = objCategory.CategoryName;
                    Page.MetaDescription = objCategory.CategoryDesc;
                }
            }
        }
        catch (System.Threading.ThreadAbortException ex)
        {
            //
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            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()]));
        }
    }
Пример #18
0
    protected void ddlInstallers_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlInstallers.SelectedIndex > -1)
            {
                Guid InstallerID = new Guid(ddlInstallers.SelectedValue);
                LinqToSqlDataContext dataCtxt = new LinqToSqlDataContext();

                var InstallerDetails = (from instDtls in dataCtxt.VW_InstallerDetails
                                        where instDtls.InstallerCompanyID == InstallerID
                                        select instDtls).FirstOrDefault();

                //var Installer = (from installers in dataCtxt.Installers
                //                 where
                //                 installers.InstallerCompanyID == InstallerID
                //                 select installers).FirstOrDefault();
                //var address = (from add in dataCtxt.InstallerAddresses
                //               where add.AddressID == Installer.AddressID
                //               select add).FirstOrDefault();

                string strCompanyInfo = "";
                strCompanyInfo = "<br/><b>" + strCompanyInfo + InstallerDetails.CompanyName + "</b><br/>";
                strCompanyInfo = strCompanyInfo + (String.IsNullOrEmpty(InstallerDetails.Accreditation) ? ("Acc: " + InstallerDetails.Accreditation + "<br/>") : "");
                strCompanyInfo = strCompanyInfo + "CSL Code: " + InstallerDetails.UniqueCode + "<br/>";
                strCompanyInfo = strCompanyInfo + InstallerDetails.AddressOne + ", " + InstallerDetails.AddressTwo + "<br/>";
                strCompanyInfo = strCompanyInfo + InstallerDetails.Town + ", " + InstallerDetails.County + "<br/>";
                strCompanyInfo = strCompanyInfo + InstallerDetails.PostCode + "<br/>";
                strCompanyInfo = strCompanyInfo + InstallerDetails.Country + "<br/>";

                ltrCompanyInfo.Text = strCompanyInfo;
                Session[enumSessions.SelectedInstaller.ToString()]  = ddlInstallers.SelectedItem.Text;
                Session[enumSessions.InstallerCompanyID.ToString()] = ddlInstallers.SelectedValue.ToString();
                AjaxControlToolkit.ModalPopupExtender mpInstaller = Parent.FindControl("mpInstaller") as AjaxControlToolkit.ModalPopupExtender;
                if (mpInstaller != null)
                {
                    mpInstaller.Show();
                }
            }
        }
        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()]));
        }
    }
Пример #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         ltrErrorMsg.Text = "";
         Response.Cache.SetExpires(DateTime.UtcNow.AddMilliseconds(-1));
         Response.Cache.SetCacheability(HttpCacheability.NoCache);
         Response.Cache.SetNoStore();
         Response.AppendHeader("Pragma", "no-cache");
         Page.Header.DataBind();
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         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()]));
     }
 }
    public static string GetOrderInfo(int orderid)
    {
        string orderData = "";

        try
        {
            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                var orderItemsWithEM = db.USP_GetEmizonOrderItems(orderid);
                var data             = orderItemsWithEM.Select(x =>
                                                               new
                {
                    ProductCode = x.ProductCode,
                    ProductDesc = x.ProductName,
                    EMNO        = string.IsNullOrEmpty(x.EM_No) ? "" : x.EM_No,
                    InstallID   = x.GPRSNo,
                    //EMNo = "EMNo: " + x.EM_No + (string.IsNullOrEmpty(x.GPRSNo) ? "" : ", InstallID: " + x.GPRSNo), //only show installid if available as not all ARC's has this feature
                    SerialNo          = string.IsNullOrEmpty(x.EM_TCD_SerialNo) ? "N/A" : x.EM_TCD_SerialNo,
                    EM_APIMsg         = string.IsNullOrEmpty(x.EM_APIMsg) ? "" :  x.EM_APIMsg,
                    EM_APIStatusID    = x.EM_APIStatusID.HasValue ? x.EM_APIStatusID.ToString() : "",
                    OrderItemDetailId = x.OrderItemDetailId,
                }
                                                               ).ToList();

                Newtonsoft.Json.JsonSerializer jsr = new Newtonsoft.Json.JsonSerializer();
                System.IO.StringWriter         sw  = new System.IO.StringWriter();
                Newtonsoft.Json.JsonTextWriter jtw = new Newtonsoft.Json.JsonTextWriter(sw);
                jsr.Serialize(jtw, data.ToArray());
                orderData = sw.ToString();
            }
        }
        catch (Exception objException)
        {
            try
            {
                CSLOrderingARCBAL.LinqToSqlDataContext db;
                db = new CSLOrderingARCBAL.LinqToSqlDataContext();
                db.USP_SaveErrorDetails("OrderconfirmationEmizon", "LoadEmizonOrderData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException),
                                        Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName());
            }
            catch { }
        }
        return(orderData);
    }
Пример #21
0
 private void AuditUpdateofUser(Guid OrderingUserId, Guid?KeycloakUserId)
 {
     try
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         CSLOrderingARCBAL.User_Migration_KC _usermigration = (from user in db.User_Migration_KCs
                                                               where user.UserId == OrderingUserId
                                                               select user).SingleOrDefault();
         _usermigration.ModifiedOn = System.DateTime.Now;
         db.SubmitChanges();
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails("Authentication Service", "AuditUpdateofUser" + OrderingUserId.ToString(), Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", "", false, OrderingUserId.ToString());
     }
 }
Пример #22
0
 protected override void OnPreRender(EventArgs e)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             //upnlUserInfo.Visible = true;//commented by atiq on 28-mar-2016
             divTopMenu.Visible   = true;
             divLoginInfo.Visible = true;
             LoadUserInfo();
         }
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails(Request.Url.ToString(), "OnPreRender", 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()]));
     }
 }
    DataSet ReadExcel(string fileNameToUpload)
    {
        DataSet ds = new DataSet();

        string fileExt = Path.GetExtension(fileUploadCon.FileName);

        string connString = "";

        if (fileExt == ".xls")
        {
            connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("UploadedOrders") + "\\" + fileNameToUpload + ";Extended Properties=Excel 8.0;";
        }
        else
        {
            connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("UploadedOrders") + "\\" + fileNameToUpload + ";Extended Properties=Excel 12.0;";
        }
        System.Data.OleDb.OleDbConnection oledbConn = new System.Data.OleDb.OleDbConnection(connString);
        try
        {
            oledbConn.Open();
            System.Data.OleDb.OleDbCommand     cmd   = new System.Data.OleDb.OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn);
            System.Data.OleDb.OleDbDataAdapter oleda = new System.Data.OleDb.OleDbDataAdapter();
            oleda.SelectCommand = cmd;
            oleda.Fill(ds);
        }
        catch (Exception objException)
        {
            if (objException != null && objException.Message != null)
            {
                string script = "alertify.alert('" + objException.Message + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "ReadExcel", 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
        {
            oledbConn.Close();
        }
        return(ds);
    }
    private void LoadOrderData()
    {
        try
        {
            int orderid = 0;
            int.TryParse(hdnOrderID.Value, out orderid);

            using (LinqToSqlDataContext db = new LinqToSqlDataContext())
            {
                var order = db.Orders.Where(x => x.OrderId == orderid).FirstOrDefault();
                if (order != null)
                {
                    lblOrderNumber.Text = "CSL" + order.OrderNo;
                    lblOrderRef.Text    = order.OrderRefNo;
                }

                //var orderItemsWithEM = db.USP_GetEmizonOrderItems(orderid);
                //var data = orderItemsWithEM.Select(x =>
                //    new
                //    {
                //        ProductCode = x.ProductCode,
                //        ProductDesc = x.ProductName,
                //        EMNO = "EMNo: " + x.EM_No + (string.IsNullOrEmpty(x.GPRSNo) ? "" : ", InstallID: " + x.GPRSNo), //only show installid if available as not all ARC's has this feature
                //        SerialNo = string.IsNullOrEmpty(x.EM_TCD_SerialNo) ? "N/A" : x.EM_TCD_SerialNo,
                //    }
                //    );
                //gvOrderItems.DataSource = data;
                //gvOrderItems.DataBind();
            }
        }
        catch (Exception objException)
        {
            try
            {
                CSLOrderingARCBAL.LinqToSqlDataContext db;
                db = new CSLOrderingARCBAL.LinqToSqlDataContext();
                db.USP_SaveErrorDetails(Request.Url.ToString(), "LoadEmizonOrderData", Convert.ToString(objException.Message), Convert.ToString(objException.InnerException),
                                        Convert.ToString(objException.StackTrace), "", HttpContext.Current.Request.UserHostAddress, false, SiteUtility.GetUserName());
            }
            catch { }
        }
    }
Пример #25
0
 private CSLOrderingARCBAL.User_Migration_KC GetMigratedUserDetail(Guid OrderingUserId)
 {
     CSLOrderingARCBAL.User_Migration_KC _usermigration = null;
     try
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db             = new CSLOrderingARCBAL.LinqToSqlDataContext();
         _usermigration = (from user in db.User_Migration_KCs
                           where user.UserId == OrderingUserId
                           select user).SingleOrDefault();
         return(_usermigration);
     }
     catch (Exception objException)
     {
         CSLOrderingARCBAL.LinqToSqlDataContext db;
         db = new CSLOrderingARCBAL.LinqToSqlDataContext();
         db.USP_SaveErrorDetails("Authentication Service", "GetKeyCloakUserId" + OrderingUserId.ToString(), Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", "", false, OrderingUserId.ToString());
     }
     return(_usermigration);
 }
Пример #26
0
    DataSet ReadExcelOld()
    {
        DataSet         ds = new DataSet();
        OdbcConnection  myConnection;
        OdbcCommand     cmd = null;
        OdbcDataAdapter da  = new OdbcDataAdapter();

        myConnection = new OdbcConnection();
        string strSQL = "SELECT * FROM [Sheet1$]";

        try
        {
            cmd = new OdbcCommand(strSQL, myConnection);
            da  = new OdbcDataAdapter(cmd);

            string filename = fileUploadCon.PostedFile.FileName;
            string connstr  = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + filename + ";";
            myConnection.ConnectionString = connstr;
            myConnection.Open();
            da.Fill(ds);
        }
        catch (Exception objException)
        {
            if (objException != null && objException.Message != null)
            {
                string script = "alertify.alert('" + objException.Message + "');";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", script, true);
            }
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails(Request.Url.ToString(), "ReadExcelOld", 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
        {
            myConnection.Close();
            cmd.Dispose();
            da.Dispose();
            myConnection.Dispose();
        }
        return(ds);
    }
Пример #27
0
    public void MigratetoKeyCloak(string UserName, string Password, string Email, string FirstName, string LastName, Guid OrderingUserId, DateTime LastPasswordChangedDate)
    {
        try
        {
            CSLOrderingARCBAL.User_Migration_KC _migrateduserdetail = GetMigratedUserDetail(OrderingUserId);
            Guid?KeyCloakUserID = null;

            if (_migrateduserdetail != null)
            {
                if (_migrateduserdetail.ModifiedOn >= LastPasswordChangedDate)
                {  //**User added already and password hasnt been changed since **//
                    return;
                }
                KeyCloakUserID = _migrateduserdetail.KeyCloakUserId;
            }

            string access_token = GetAdminToken().Result;
            if (!string.IsNullOrWhiteSpace(access_token))
            {
                keycloakuser keycloakuser = new keycloakuser(UserName, FirstName, LastName, Email, Password);
                string       JsonObject   = Newtonsoft.Json.JsonConvert.SerializeObject(keycloakuser);
                var          Jsoncontent  = new StringContent(JsonObject, Encoding.UTF8, "application/json");
                Jsoncontent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                if (KeyCloakUserID == null)// ** New User
                {
                    var adduser = AddasNewUser(access_token, OrderingUserId, Jsoncontent).Result;
                }
                else // ** Already in KeyCloak
                {
                    var updateuser = UpdateExistingUser(access_token, OrderingUserId, KeyCloakUserID.ToString(), Jsoncontent).Result;
                }
            }
        }
        catch (Exception objException)
        {
            CSLOrderingARCBAL.LinqToSqlDataContext db;
            db = new CSLOrderingARCBAL.LinqToSqlDataContext();
            db.USP_SaveErrorDetails("Authentication Service", "MigratetoKeyCloak -" + OrderingUserId.ToString(), Convert.ToString(objException.Message), Convert.ToString(objException.InnerException), Convert.ToString(objException.StackTrace), "", "", false, OrderingUserId.ToString());
        }
    }
Пример #28
0
 protected void gvDevicelist_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int selectedRow = gvDevicelist.SelectedIndex;
         if (gvDevicelist.Rows.Count > 0)
         {
             chip.Text         = Server.HtmlDecode(gvDevicelist.Rows[selectedRow].Cells[1].Text).Trim();
             nua_data.Text     = Server.HtmlDecode(gvDevicelist.Rows[selectedRow].Cells[2].Text).Trim();
             esn_sim.Text      = Server.HtmlDecode(gvDevicelist.Rows[selectedRow].Cells[3].Text).Trim();
             SelectedEMNo.Text = Server.HtmlDecode(gvDevicelist.Rows[selectedRow].Cells[4].Text).Trim();
             int Dev_Inst_UnqCode = Convert.ToInt32(gvDevicelist.DataKeys[selectedRow].Values["Dev_Inst_UnqCode"].ToString());
             if (Dev_Inst_UnqCode != 0)
             {
                 VW_InstallerDetail installer = CSLOrderingARCBAL.BAL.InstallerBAL.GetInstaller(Dev_Inst_UnqCode.ToString());
                 if (installer != null)
                 {
                     TextBox txtInstaller;
                     if (enablePostCodeSearch)
                     {
                         txtInstaller = (TextBox)Installers.FindControl("installerCompanyName");
                     }
                     else
                     {
                         txtInstaller = (TextBox)Installers.FindControl("installerCompanyName");
                         Button btnSearch = (Button)Installers.FindControl("btnSearch");
                     }
                     txtInstaller.Text = installer.CompanyName;
                 }
             }
             LockSelection();
         }
     }
     catch (Exception objException)
     {
         using (LinqToSqlDataContext db = new CSLOrderingARCBAL.LinqToSqlDataContext())
         {
             db.USP_SaveErrorDetails(Request.Url.ToString(), "gvDevicelist_SelectedIndexChanged", 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()]));
         }
     }
 }
Пример #29
0
    public void LoadData()
    {
        CSLOrderingARCBAL.LinqToSqlDataContext db = null;
        try
        {
            ddlGrade.DataSource     = ProductBAL.GradeList();
            ddlGrade.DataTextField  = "Grade";
            ddlGrade.DataValueField = "Grade";
            ddlGrade.DataBind();

            gvGrade.DataSource = ProductBAL.GetProductGrade();
            gvGrade.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()]));
            db.Dispose();
        }
    }
Пример #30
0
    private string LoadARCEmailCC()
    {
        string val = string.Empty;
        LinqToSqlDataContext db = new LinqToSqlDataContext();

        try
        {
            val = db.USP_GetARCEmailCC(Convert.ToInt32(Session[enumSessions.ARC_Id.ToString()].ToString())).FirstOrDefault().ARC_CCEMAIL;
        }
        catch (Exception objException)
        {
            db = new CSLOrderingARCBAL.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()]));
            db.Dispose();
        }
        finally
        {
            db.Dispose();
        }
        return(val);
    }