Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["indico-usrnm"].Value   = string.Empty;
            Response.Cookies["indico-usrnm"].Expires = DateTime.Now.AddDays(-15);
            Response.Cookies["indico-pswrd"].Value   = string.Empty;
            Response.Cookies["indico-pswrd"].Expires = DateTime.Now.AddDays(-15);

            try
            {
                if (HttpContext.Current.Session["in_sid"] != null)
                {
                    UserBO objUser = this.LoggedUser;
                    Session["UserMenuItemRoleView" + this.LoggedUser.ID] = null;

                    IndicoPage.EndSession(ref objUser);
                }
                Session.Abandon();
            }
            catch { }

            SessionIDManager manager = new SessionIDManager();
            var isRedirected = false; var isAdded = false;

            manager.SaveSessionID(this.Context, manager.CreateSessionID(Context), out isRedirected, out isAdded);

            Response.Redirect("/Login.aspx");
        }
Ejemplo n.º 2
0
        protected void dgOrders_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is ClientOrderDetailsViewBO)
            {
                ClientOrderDetailsViewBO objClientOrder = (ClientOrderDetailsViewBO)item.DataItem;

                Label lblOrderDate = (Label)item.FindControl("lblOrderDate");
                lblOrderDate.Text = ((DateTime)objClientOrder.Date).ToString("dd MMM yyyy");

                Label lblDesiredDate = (Label)item.FindControl("lblDesiredDate");
                //SDU lblDesiredDate.Text = ((DateTime)objClientOrder.DesiredDeliveryDate).ToString("dd MMM yyyy");

                Label lblVlNumber = (Label)item.FindControl("lblVlNumber");
                lblVlNumber.Text = objClientOrder.NamePrefix + "" + objClientOrder.NameSuffix + " - " + objClientOrder.PatternNumber + " - " + objClientOrder.FabricNickName;

                HtmlAnchor ancVLImage = (HtmlAnchor)item.FindControl("ancVLImage");
                ancVLImage.HRef = IndicoPage.GetVLImagePath((int)objClientOrder.VisualLayoutId);
                if (File.Exists(Server.MapPath(ancVLImage.HRef)))
                {
                    ancVLImage.Attributes.Add("class", "btn-link iview preview");
                    List <float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstVLImageDimensions.Count > 0)
                    {
                        ancVLImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                        ancVLImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancVLImage.Title = "Visual Layout Image Not Found";
                    ancVLImage.Attributes.Add("class", "btn-link iremove");
                }

                Label lblOrderStatus = (Label)item.FindControl("lblOrderStatus");
                lblOrderStatus.Text = objClientOrder.Status;
                //lblOrderStatus.Attributes.Add("class", objClientOrder.Status.ToLower());
                lblOrderStatus.CssClass = objClientOrder.Status.ToLower().Replace(" ", "");

                HtmlAnchor linkOrderQty = (HtmlAnchor)item.FindControl("linkOrderQty");
                linkOrderQty.Attributes.Add("qid", objClientOrder.OrderDetailId.ToString());

                HyperLink linkEditView = (HyperLink)item.FindControl("linkEditView");
                linkEditView.CssClass    = "btn-link " + (((bool)objClientOrder.IsTemporary) ? "iedit" : "iview");
                linkEditView.ToolTip     = (((bool)objClientOrder.IsTemporary) ? "Edit Order" : "View Order");
                linkEditView.NavigateUrl = "AddEditClientOrder.aspx?id=" + objClientOrder.OrderId.ToString();
            }
        }
Ejemplo n.º 3
0
        protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args)
        {
            try
            {
                //ReturnIntViewBO objReturnInt = new ReturnIntViewBO();
                //objReturnInt = SettingsBO.ValidateField(this.QueryID, "JobName", "Name", this.txtName.Text);
                //args.IsValid = objReturnInt.RetVal == 1;

                int clientID = int.Parse(this.ddlClient.SelectedValue);
                args.IsValid = IndicoPage.ValidateField2(this.QueryID, "JobName", "Name", this.txtName.Text, "Client", clientID.ToString()) == 1;
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on AddEditClient.aspx", ex);
            }
        }
Ejemplo n.º 4
0
        protected void cvTxtName_ServerValidate(object source, ServerValidateEventArgs args)
        {
            try
            {
                int clientID = int.Parse(this.hdnSelectedClientID.Value.Trim());
                int disID    = int.Parse(ddlDistributor.SelectedValue);

                //ReturnIntViewBO objReturnInt = new ReturnIntViewBO();
                //objReturnInt = SettingsBO.ValidateField(clientID, "Client", "Name", this.txtClientName.Text);
                //args.IsValid = objReturnInt.RetVal == 1;

                args.IsValid = IndicoPage.ValidateField2(clientID, "Client", "Name", this.txtClientName.Text, "Distributor", disID.ToString()) == 1;
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while cvTxtName_ServerValidate on ViewDistributorClients.aspx", ex);
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (this.QueryID > 0)
                {
                    OrderBO objOrder = new OrderBO();
                    objOrder.ID = this.QueryID;
                    objOrder.GetObject();

                    OrderDetailBO objOrderDetail = new OrderDetailBO();
                    objOrderDetail.Order = objOrder.ID;
                    List <OrderDetailBO> lstOrderDetails = objOrderDetail.SearchObjects();
                    objOrderDetail = lstOrderDetails.First();

                    this.lblDistributor.Text     = objOrder.objDistributor.Name;
                    this.lblJobName.Text         = objOrder.objClient.Name;
                    this.lblClient.Text          = objOrder.objClient.objClient.Name;
                    this.lblDespatchAddress.Text = objOrder.objDespatchToAddress.CompanyName + "  " + objOrder.objDespatchToAddress.Address + "  "
                                                   + objOrder.objDespatchToAddress.PostCode + "  " + objOrder.objDespatchToAddress.Suburb + "  "
                                                   + objOrder.objDespatchToAddress.PostCode + "  " + objOrder.objDespatchToAddress.State + "  "
                                                   + objOrder.objDespatchToAddress.objCountry.ShortName;;

                    this.lblBillingAddress.Text = objOrder.objBillingAddress.CompanyName + "  " + objOrder.objBillingAddress.Address + "  "
                                                  + objOrder.objBillingAddress.PostCode + "  " + objOrder.objBillingAddress.Suburb + "  "
                                                  + objOrder.objBillingAddress.PostCode + "  " + objOrder.objBillingAddress.State + "  "
                                                  + objOrder.objBillingAddress.objCountry.ShortName;
                    int processingPeriod = 5;
                    int.TryParse(IndicoPage.GetSetting("OPP"), out processingPeriod);
                    lblDateRequiredinCustomersHand.Text = IndicoPage.GetNextWeekday(DayOfWeek.Monday).AddDays(7 * (processingPeriod - 1)).ToString("dd MMMM yyyy");


                    int.TryParse(IndicoPage.GetSetting("OPP"), out processingPeriod);
                    lblShipmentDate.Text = IndicoPage.GetNextWeekday(DayOfWeek.Monday).AddDays(7 * (processingPeriod - 1) - 2).ToString("dd MMMM yyyy");

                    this.lblShipmentTerm.Text = objOrderDetail.objPaymentMethod.Name;
                    this.lblShipmentMode.Text = objOrderDetail.objShipmentMode.Name;

                    this.rptOrderDetails.DataSource = lstOrderDetails;
                    this.rptOrderDetails.DataBind();
                }
            }
        }
Ejemplo n.º 6
0
        protected void rptOrderDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is OrderDetailBO)
            {
                OrderDetailBO objOrderDetail = (OrderDetailBO)item.DataItem;

                CheckBox chkOrderDetail  = (CheckBox)item.FindControl("chkOrderDetail");
                Label    lblVisualLayout = (Label)item.FindControl("lblVisualLayout");
                lblVisualLayout.Text = objOrderDetail.objVisualLayout.NamePrefix + " / " + objOrderDetail.objPattern.Number + " " + objOrderDetail.objPattern.NickName + " / " + objOrderDetail.objFabricCode.Code + " " + objOrderDetail.objFabricCode.Name;


                HtmlAnchor         ancVLImage   = (HtmlAnchor)item.FindControl("ancVLImage");
                HtmlGenericControl ivlimageView = (HtmlGenericControl)item.FindControl("ivlimageView");

                ancVLImage.HRef = IndicoPage.GetVLImagePath((int)objOrderDetail.VisualLayout);

                if (!string.IsNullOrEmpty(ancVLImage.HRef))
                {
                    ancVLImage.Attributes.Add("class", "btn-link preview");
                    ivlimageView.Attributes.Add("class", "icon-eye-open");

                    List <float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimension(960, 720, 420, 360);
                    if (lstVLImageDimensions.Count > 0)
                    {
                        ancVLImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                        ancVLImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                    }
                }
                else
                {
                    ancVLImage.Title = "Visual Layout Image Not Available";
                    ivlimageView.Attributes.Add("class", "icon-eye-close");
                }

                HiddenField ODID = (HiddenField)item.FindControl("hdnODID");
                ODID.Value = objOrderDetail.ID.ToString();
            }
        }
Ejemplo n.º 7
0
        protected void RadGridVisualLayouts_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if ((item.ItemIndex > -1 && item.DataItem is VisualLayoutDetailsView))
                {
                    try
                    {
                        VisualLayoutDetailsView objVisualLayoutDetails = (VisualLayoutDetailsView)item.DataItem;

                        HtmlAnchor         ancMainImage = (HtmlAnchor)item.FindControl("ancMainImage");
                        HtmlGenericControl iVlimageView = (HtmlGenericControl)item.FindControl("iVlimageView");

                        if (!string.IsNullOrEmpty(objVisualLayoutDetails.FileName + objVisualLayoutDetails.Extension))
                        {
                            ancMainImage.Title = "Visual Layout Image";
                            ancMainImage.HRef  = IndicoPage.GetVLImagePath(objVisualLayoutDetails.VisualLayout, objVisualLayoutDetails.FileName, objVisualLayoutDetails.Extension);

                            ancMainImage.Attributes.Add("class", "btn-link preview");
                            iVlimageView.Attributes.Add("class", "icon-eye-open");

                            try
                            {
                                System.Drawing.Image VLOrigImage = System.Drawing.Image.FromFile(IndicoConfiguration.AppConfiguration.PathToProjectFolder + "\\" + ancMainImage.HRef);
                                SizeF origImageSize = VLOrigImage.PhysicalDimension;
                                VLOrigImage.Dispose();

                                List <float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimensionForHeight(Convert.ToInt32(Math.Abs(origImageSize.Width)), Convert.ToInt32(Math.Abs(origImageSize.Height)), 350);

                                if (lstVLImageDimensions.Count > 0)
                                {
                                    ancMainImage.Attributes.Add("height", lstVLImageDimensions[0].ToString());
                                    ancMainImage.Attributes.Add("width", lstVLImageDimensions[1].ToString());
                                }
                            }
                            catch (Exception ex)
                            {
                                ancMainImage.Title = "Visual Layout Image Not Found";
                                iVlimageView.Attributes.Add("class", "icon-eye-close");
                            }
                        }
                        else
                        {
                            ancMainImage.Title = "Visual Layout Image Not Found";
                            iVlimageView.Attributes.Add("class", "icon-eye-close");
                        }

                        Literal lblIsGenerated = (Literal)item.FindControl("lblIsGenerated");
                        //lblIsGenerated.Text = (objVisualLayoutDetails.)

                        HyperLink lnkEdit = (HyperLink)item.FindControl("lnkEdit");
                        lnkEdit.NavigateUrl = "AddEditVisualLayout.aspx?id=" + objVisualLayoutDetails.VisualLayout.ToString();

                        HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                        linkDelete.Attributes.Add("qid", objVisualLayoutDetails.VisualLayout.ToString());

                        linkDelete.Visible = objVisualLayoutDetails.CanDelete ?? false;

                        DropDownList ddlResolutionProfile = (DropDownList)item.FindControl("ddlResolutionProfile");
                        DropDownList ddlPrinter           = (DropDownList)item.FindControl("ddlPrinter");

                        ddlResolutionProfile.Items.Add(new ListItem("Select Resolution Profile", "0"));
                        ddlPrinter.Items.Add(new ListItem("Select Printer", "0"));

                        ddlResolutionProfile.Attributes.Add("vlid", objVisualLayoutDetails.VisualLayout.ToString());
                        ddlPrinter.Attributes.Add("vlid", objVisualLayoutDetails.VisualLayout.ToString());

                        foreach (ResolutionProfileBO res in ResolutionProfile_Source)
                        {
                            ddlResolutionProfile.Items.Add(new ListItem(res.Name, res.ID.ToString()));
                        }

                        foreach (PrinterBO printer in Printer_Source)
                        {
                            ddlPrinter.Items.Add(new ListItem(printer.Name, printer.ID.ToString()));
                        }

                        ddlResolutionProfile.Items.FindByValue(objVisualLayoutDetails.ResolutionProfile.ToString()).Selected = true;
                        ddlPrinter.Items.FindByValue(objVisualLayoutDetails.Printer.ToString()).Selected = true;
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            HttpRuntimeSection runTime = (HttpRuntimeSection)WebConfigurationManager.GetSection("system.web/httpRuntime");
            int maxRequestLength       = (runTime.MaxRequestLength - 100) * 1024;

            if (context.Request.ContentLength > maxRequestLength)
            {
                return;
            }

            if (context.Request.Files.Count == 0)
            {
                IndicoLogging.log.Error("Upload failed. No files received. " + DateTime.Now.ToString("dd MMM yyyy hh:mm:ss tt"));
                context.Response.Write("No files received.");
            }
            else
            {
                HttpFileCollection filecollection = context.Request.Files;
                for (int i = 0; i < filecollection.Count; i++)
                {
                    HttpPostedFile uploadedfile = filecollection[i];

                    string fileKey = string.Empty;
                    if (context.Request.Params.Get("filekey") != null)
                    {
                        fileKey = context.Request.Params.Get("filekey").Trim();
                    }
                    else
                    {
                        fileKey = (new Random()).Next(100, 999).ToString();
                    }

                    string fileName = Path.GetFileName(uploadedfile.FileName.Trim());
                    double fileSize = Math.Round(double.Parse(uploadedfile.ContentLength.ToString()) / 1024 * 1000) / 1000;
                    string fileType = uploadedfile.ContentType;

                    string subFolder  = context.Request.Params.Get("ctl00$subfolder");
                    string folderPath = IndicoConfiguration.AppConfiguration.PathToDataFolder + "\\temp\\" + subFolder;
                    string fileUrl    = Path.GetFileNameWithoutExtension(fileName.Replace(' ', '-')) + "_" + fileKey + Path.GetExtension(fileName);
                    string filePath   = folderPath + "\\" + fileUrl;

                    try
                    {
                        if (!Directory.Exists(folderPath))
                        {
                            Directory.CreateDirectory(folderPath);
                        }

                        uploadedfile.SaveAs(filePath);

                        string height = "0";
                        string width  = "0";

                        if (IndicoPage.IsImageFile(Path.GetExtension(filePath)))
                        {
                            System.Drawing.Image activityOrigImage = System.Drawing.Image.FromFile(filePath);
                            SizeF        origImageSize             = activityOrigImage.PhysicalDimension;
                            List <float> lstImgDimensions          = (new ImageProcess()).GetResizedImageDimension(Convert.ToInt32(Math.Abs(origImageSize.Width)), Convert.ToInt32(Math.Abs(origImageSize.Height)), 250, 140);

                            height = lstImgDimensions[0].ToString();
                            width  = lstImgDimensions[1].ToString();
                        }
                        context.Response.Write("{\"name\":\"" + fileName + "\",\"type\":\"" + fileType + "\",\"filesize\":\"" + fileSize.ToString() + "\" ,\"size\":\"" + fileSize.ToString() + " Kb\",\"key\":\"" + fileKey + "\",\"url\":\"" + fileUrl + "\",\"height\":\"" + height + "\",\"width\":\"" + width + "\"}");

                        IndicoLogging.log.Info("Upload Success. " + DateTime.Now.ToString("dd MMM yyyy hh:mm:ss tt") + Environment.NewLine + fileName + " ," + fileUrl + ", " + fileType + ", " + fileSize);
                    }
                    catch (HttpException hx)
                    {
                        IndicoLogging.log.Error("Upload failed. ", hx);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        protected void RadGridCostSheets_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridHeaderItem)
            {
                if (DisplayPriceLevels)
                {
                    IndicoPage             page           = new IndicoPage();
                    GridHeaderItem         item           = (GridHeaderItem)e.Item;
                    List <PriceLevelNewBO> lstPriceLevels = new PriceLevelNewBO().SearchObjects();

                    foreach (PriceLevelNewBO objLevel in lstPriceLevels)
                    {
                        TableCell cell = (TableCell)item[objLevel.Volume.Replace(' ', '_')];

                        Label lblBR = new Label();
                        lblBR.Text = objLevel.Volume + " units</br>";
                        cell.Controls.Add(lblBR);

                        if (page.LoggedUserRoleName == IndicoPage.UserRole.IndimanAdministrator || page.LoggedUserRoleName == IndicoPage.UserRole.IndicoAdministrator)
                        {
                            Button btnApply = new Button();
                            btnApply.Text        = "Apply";
                            btnApply.CssClass    = "btn btn-info";
                            btnApply.ForeColor   = Color.White;
                            btnApply.Click      += btnApply_Click;
                            btnApply.CommandName = objLevel.ID.ToString();

                            TextBox txtPrice = new TextBox();
                            txtPrice.ID          = "txtPrice" + objLevel.ID.ToString();
                            txtPrice.Text        = objLevel.Markup.ToString();
                            txtPrice.Width       = Unit.Pixel(50);
                            txtPrice.BorderStyle = BorderStyle.Inset;
                            txtPrice.Height      = Unit.Pixel(15);
                            txtPrice.Width       = Unit.Pixel(40);

                            cell.Controls.Add(txtPrice);
                            cell.Controls.Add(btnApply);
                        }
                        else
                        {
                            Label lblPercentage = new Label();
                            lblPercentage.Text  = objLevel.Markup.ToString() + "%";
                            lblPercentage.Width = Unit.Pixel(50);
                            cell.Controls.Add(lblPercentage);
                        }
                    }
                }
            }
            else if (e.Item is GridDataItem)
            {
                if (this.DisplayMarginRates && !this.IsFOB)
                {
                    var         item     = e.Item as GridDataItem;
                    DataRowView objPrice = (DataRowView)item.DataItem;

                    Button btnSave = new Button();
                    btnSave.ID          = "btnSave";
                    btnSave.Text        = "Save";
                    btnSave.CssClass    = "btn btn-info";
                    btnSave.ForeColor   = Color.White;
                    btnSave.Width       = Unit.Pixel(50);
                    btnSave.CommandName = "Save";
                    item["Save"].Controls.Add(btnSave);
                }
            }
        }