private void ComparePatternGarmentSpec(int pattern)
        {
            PatternBO objPattern = new PatternBO();

            objPattern.ID = pattern;
            objPattern.GetObject();

            this.litPattern2.Text = objPattern.Number + " - " + objPattern.NickName;

            List <SizeChartBO> lstSizeCharts = objPattern.SizeChartsWhereThisIsPattern;


            List <IGrouping <int, SizeChartBO> > lstSizeChartGroup = lstSizeCharts.OrderBy(o => o.objMeasurementLocation.Key).GroupBy(o => o.MeasurementLocation).ToList();

            if (lstSizeChartGroup.Count > 0)
            {
                this.rptCompareSpecSizeQtyHeader.DataSource = (List <SizeChartBO>)lstSizeChartGroup[0].ToList();
                this.rptCompareSpecSizeQtyHeader.DataBind();

                this.rptCompareSpecML.DataSource = lstSizeChartGroup;
                this.rptCompareSpecML.DataBind();
            }

            this.dvComparePatternEmpty.Visible  = (lstSizeCharts.Count > 0) ? false : true;
            this.linkComparePattern.NavigateUrl = "~/AddEditPattern.aspx?id=" + objPattern.ID.ToString();
            this.dvEmptyDiffrence.Visible       = (lstSizeCharts.Count > 0) ? false : true;
            this.dvComparePattern.Visible       = (lstSizeChartGroup.Count > 0) ? true : false;
            this.dvDiffrence.Visible            = (lstSizeChartGroup.Count > 0) ? true : false;
            this.legPattern02.Visible           = true;
            this.legDiffrence.Visible           = true;
        }
        private void PopulateOriginalPatternSpec(int pattern)
        {
            PatternBO objPattern = new PatternBO();

            objPattern.ID = pattern;
            objPattern.GetObject();

            SizeSetBO objSizeSet = new SizeSetBO();

            objSizeSet.ID = objPattern.SizeSet;
            objSizeSet.GetObject();

            List <SizeChartBO> lstSizeCharts = objPattern.SizeChartsWhereThisIsPattern;

            List <IGrouping <int, SizeChartBO> > lstSizeChartGroup = lstSizeCharts.OrderBy(o => o.objMeasurementLocation.Key).GroupBy(o => o.MeasurementLocation).ToList();

            if (lstSizeChartGroup.Count > 0)
            {
                this.rptSpecSizeQtyHeader.DataSource = (List <SizeChartBO>)lstSizeChartGroup[0].ToList();
                this.rptSpecSizeQtyHeader.DataBind();

                this.rptSpecML.DataSource = lstSizeChartGroup;
                this.rptSpecML.DataBind();
            }

            this.ddlComparePattern.Enabled = (lstSizeCharts.Count > 0) ? true : false;
            this.dvEmptyPattern.Visible    = (lstSizeCharts.Count > 0) ? false : true;
            this.linkPattern.NavigateUrl   = "~/AddEditPattern.aspx?id=" + objPattern.ID.ToString();
            this.dvOriginalPattern.Visible = (lstSizeCharts.Count > 0) ? true : false;
            this.legPattern01.Visible      = true;
        }
        protected void RadGridPattern_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = e.Item as GridDataItem;

                if ((item.ItemIndex > -1 && item.DataItem is ReturnPatternDetailsViewBO))
                {
                    ReturnPatternDetailsViewBO objPatternDetails = (ReturnPatternDetailsViewBO)item.DataItem;

                    TextBox txtManualDescription = (TextBox)item.FindControl("txtManualDescription");
                    txtManualDescription.Text = objPatternDetails.Remarks;

                    TextBox txtMarketingDescription = (TextBox)item.FindControl("txtMarketingDescription");
                    txtMarketingDescription.Text = objPatternDetails.MarketingDescription;

                    TextBox txNotes = (TextBox)item.FindControl("txNotes");
                    txNotes.Text = objPatternDetails.PatternNotes;

                    TextBox txtFactoryDescription = (TextBox)item.FindControl("txtFactoryDescription");
                    txtFactoryDescription.Text = objPatternDetails.FactoryDescription;

                    PatternBO objPattern = new PatternBO();
                    objPattern.ID = (int)objPatternDetails.Pattern;
                    objPattern.GetObject();

                    string status = this.PopulateGarmentSpecStatus(objPattern);

                    RadGridPattern.Columns[12].Visible = (this.LoggedUser.HaveAccessForHTTPPost != null) ? (bool)this.LoggedUser.HaveAccessForHTTPPost : false;
                    Literal lblStatus = (Literal)item.FindControl("lblStatus");
                    lblStatus.Text = "<span class=\"badge badge-" + status.ToLower().Replace(" ", string.Empty).Trim() + "\">&nbsp;</span>";

                    LinkButton lbSave = (LinkButton)item.FindControl("lbSave");
                    lbSave.Attributes.Add("pid", objPatternDetails.Pattern.ToString());

                    Literal litPost = (Literal)item.FindControl("litPost");

                    bool HaveAcccessHttpPost = (this.LoggedUser.HaveAccessForHTTPPost != null) ? (bool)this.LoggedUser.HaveAccessForHTTPPost : false;
                    if (objPatternDetails.IsActiveWS == true && HaveAcccessHttpPost)
                    {
                        litPost.Text = "Sent";
                    }
                    else
                    {
                        litPost.Text = "Not yet sent";
                    }
                }
            }
        }
        protected void lbSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    foreach (GridDataItem item in RadGridPattern.Items)
                    {
                        TextBox txtManualDescription = (TextBox)item.FindControl("txtManualDescription");

                        TextBox txtMarketingDescription = (TextBox)item.FindControl("txtMarketingDescription");

                        TextBox txNotes = (TextBox)item.FindControl("txNotes");

                        TextBox txtFactoryDescription = (TextBox)item.FindControl("txtFactoryDescription");

                        LinkButton lbSave = (LinkButton)item.FindControl("lbSave");

                        int id = int.Parse(((System.Web.UI.WebControls.WebControl)(lbSave)).Attributes["pid"].ToString());

                        if (id > 0)
                        {
                            PatternBO objPattern = new PatternBO(this.ObjContext);
                            objPattern.ID = id;
                            objPattern.GetObject();

                            objPattern.Remarks            = txtManualDescription.Text;
                            objPattern.Description        = txtMarketingDescription.Text;
                            objPattern.PatternNotes       = txNotes.Text;
                            objPattern.FactoryDescription = txtFactoryDescription.Text;

                            //if (objPattern.IsActiveWS)
                            //{
                            //    this.UpdateWebService(objPattern);
                            //}
                        }
                    }
                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }

                this.PopulateDataGrid();
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while changing the notes and descriptions in Pattern from ViewDescriptionGrid.aspx", ex);
            }
        }
Пример #5
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(int queryId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    PatternBO objPattern = new PatternBO(this.ObjContext);
                    if (queryId > 0)
                    {
                        objPattern.ID = queryId;
                        objPattern.GetObject();
                    }
                    if (isDelete)
                    {
                        List <PriceBO> lstPrces = objPattern.PricesWhereThisIsPattern;
                        foreach (PriceBO price in lstPrces)
                        {
                            PriceBO objPrice = new PriceBO(this.ObjContext);
                            objPrice.ID = price.ID;
                            objPrice.GetObject();

                            foreach (PriceLevelCostBO priceLevelCost in objPrice.PriceLevelCostsWhereThisIsPrice)
                            {
                                PriceLevelCostBO objPriceLevelCost = new PriceLevelCostBO(this.ObjContext);
                                objPriceLevelCost.ID = priceLevelCost.ID;
                                objPriceLevelCost.GetObject();

                                objPriceLevelCost.Delete();
                            }

                            objPrice.Delete();
                        }
                    }
                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                //IndicoLogging.log("Error occured while Adding the Item", ex);
            }
        }
        public string Get(int id, int unit = 0) // convertType = 0 : cm / 1 : inch
        {
            try
            {
                PatternBO objPattern = new PatternBO();
                objPattern.ID = id;
                objPattern.GetObject();

                WebServicePattern objWebServicePattern = new WebServicePattern(true);
                string            filePath             = objWebServicePattern.GeneratePDF(objPattern, false, unit.ToString(), GetCompressionImagePhysicalPath(objPattern));

                filePath = filePath.Replace(IndicoConfiguration.AppConfiguration.PathToProjectFolder, IndicoConfiguration.AppConfiguration.SiteHostAddress.Replace("/", ""));
                filePath = filePath.Replace(@"\", "/");

                return(filePath);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void ddlPattern_SelectedIndexChanged(object sender, EventArgs e)
        {
            int id = int.Parse(this.ddlPattern.SelectedValue);

            if (id > 0)
            {
                this.ddlComparePattern.Enabled = true;

                this.Repopulate();

                PatternBO objPattern = new PatternBO();
                objPattern.ID = id;
                objPattern.GetObject();

                this.litPattern1.Text = objPattern.Number + " - " + objPattern.NickName;

                PatternBO objPat = new PatternBO();
                objPat.SizeSet = objPattern.SizeSet;
                objPat.Item    = objPattern.Item;

                List <PatternBO> lstPattern = objPat.SearchObjects().Where(o => o.ID != id).ToList();

                this.ddlComparePattern.Items.Clear();
                this.ddlComparePattern.Items.Add(new ListItem("Select Next Pattern", "0"));

                if (lstPattern.Count > 0)
                {
                    foreach (PatternBO pat in lstPattern)
                    {
                        this.ddlComparePattern.Items.Add(new ListItem(pat.Number + " - " + pat.NickName, pat.ID.ToString()));
                    }
                }
                else
                {
                    this.ddlComparePattern.Enabled = false;
                }

                this.PopulateOriginalPatternSpec(objPattern.ID);
            }
        }
Пример #8
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            ViewState["PopulatePatern"] = false;
            ViewState["PopulateFabric"] = false;

            if (Session["IsRefresh"].ToString() == ViewState["IsRefresh"].ToString())
            {
                int queryId = int.Parse(this.hdnPattern.Value.Trim());
                if (Page.IsValid && queryId > 0)
                {
                    try
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            PatternBO objPattern = new PatternBO(this.ObjContext);
                            objPattern.ID = queryId;
                            objPattern.GetObject();

                            objPattern.ConvertionFactor = decimal.Parse(this.txtConvertionFactor.Text.Trim());
                            objPattern.PriceRemarks     = this.txtRemarks.Text.Trim();

                            this.ObjContext.SaveChanges();
                            ts.Complete();
                        }

                        this.PopulateControls();
                    }
                    catch (Exception ex)
                    {
                        IndicoLogging.log.Error("AddEditIndimanPrice.aspx btnSaveChanges_Click()", ex);
                    }

                    Response.Redirect("/ViewPrices.aspx");
                }
                Session["IsRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());
            }
        }
        private void GetDiffrenceGarmentSpec(int original, int compare)
        {
            PatternBO objOriPattern = new PatternBO();

            objOriPattern.ID = original;
            objOriPattern.GetObject();

            PatternBO objComPattern = new PatternBO();

            objComPattern.ID = compare;
            objComPattern.GetObject();

            List <SizeChartBO> lstDiffrence = new List <SizeChartBO>();

            List <SizeChartBO> lstOriSizeCharts = objOriPattern.SizeChartsWhereThisIsPattern;

            List <SizeChartBO> lstCComSizeCharts = objComPattern.SizeChartsWhereThisIsPattern;

            foreach (SizeChartBO osc in lstOriSizeCharts)
            {
                foreach (SizeChartBO csc in lstCComSizeCharts)
                {
                    if (osc.Size == csc.Size && osc.MeasurementLocation == csc.MeasurementLocation)
                    {
                        decimal difference = (osc.Val - csc.Val);

                        MeasurementLocationBO objM = new MeasurementLocationBO();
                        objM.ID = csc.MeasurementLocation;
                        objM.GetObject();

                        SizeBO objSize = new SizeBO();
                        objSize.ID = csc.Size;
                        objSize.GetObject();

                        SizeChartBO objSizeChart = new SizeChartBO();
                        objSizeChart.ID                     = 0;
                        objSizeChart.Pattern                = csc.Pattern;// Not necessary
                        objSizeChart.MeasurementLocation    = osc.MeasurementLocation;
                        objSizeChart.objPattern             = objComPattern;
                        objSizeChart.Size                   = csc.Size;
                        objSizeChart.objSize                = objSize;
                        objSizeChart.MeasurementLocation    = csc.MeasurementLocation;
                        objSizeChart.objMeasurementLocation = objM;
                        objSizeChart.Val                    = difference;

                        lstDiffrence.Add(objSizeChart);
                    }
                }
            }

            List <IGrouping <int, SizeChartBO> > lstSizeChartGroup = lstDiffrence.OrderBy(o => o.objMeasurementLocation.Key).GroupBy(o => o.MeasurementLocation).ToList();

            if (lstSizeChartGroup.Count > 0)
            {
                this.rptDiffSpecSizeQtyHeader.DataSource = (List <SizeChartBO>)lstSizeChartGroup[0].ToList();
                this.rptDiffSpecSizeQtyHeader.DataBind();

                this.rptDiffSpecML.DataSource = lstSizeChartGroup;
                this.rptDiffSpecML.DataBind();

                this.dvDiffrence.Visible = true;
            }
        }