Ejemplo n.º 1
0
        private void DeleteSize(int queryId)
        {
            try
            {
                if (queryId > 0)
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        SizeBO objSize = new SizeBO(this.ObjContext);
                        objSize.ID = queryId;
                        objSize.GetObject();

                        List <int> lstSizeCharts = objSize.SizeChartsWhereThisIsSize.Select(o => o.ID).ToList();

                        foreach (int sizeChart in lstSizeCharts)
                        {
                            SizeChartBO objSizeChart = new SizeChartBO(this.ObjContext);
                            objSizeChart.ID = sizeChart;
                            objSizeChart.GetObject();

                            objSizeChart.Delete();
                        }

                        objSize.Delete();

                        this.ObjContext.SaveChanges();
                        ts.Complete();
                    }
                }
                else
                {
                    if (Session["ListSizes"] != null)
                    {
                        List <KeyValuePair <int, SizeBO> > lstEmptyList = (List <KeyValuePair <int, SizeBO> >)Session["ListSizes"];
                        KeyValuePair <int, SizeBO>         objSize      = lstEmptyList.Where(m => m.Key == queryId).FirstOrDefault();
                        lstEmptyList.Remove(objSize);

                        Session["ListSizes"] = lstEmptyList;
                    }
                }
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while Deleting the Size", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(int queryId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    SizeBO objSize = new SizeBO(this.ObjContext);
                    if (queryId > 0)
                    {
                        objSize.ID = queryId;
                        objSize.GetObject();
                    }

                    if (isDelete)
                    {
                        objSize.Delete();
                    }
                    else
                    {
                        objSize.SizeName = this.txtSizeName.Text;
                        objSize.SeqNo    = int.Parse(this.txtSeqNo.Text);
                        objSize.SizeSet  = int.Parse(this.ddlSizeSet.SelectedItem.Value);

                        if (queryId == 0)
                        {
                            objSize.Add();
                        }
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                //IndicoLogging.log("Error occured while Adding the Item", ex);
            }
        }
Ejemplo n.º 3
0
        private void ProcessSizeSet(bool isNewSize)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    SizeBO objSize = new SizeBO(this.ObjContext);

                    if (!isNewSize)
                    {
                        objSize.ID = int.Parse(this.hdnSelectedSizeID.Value);
                        objSize.GetObject();
                    }

                    objSize.IsDefault = (int.Parse(this.hdnIsDefault.Value.ToString()) > 0) ? true : false;
                    objSize.SizeName  = this.hdnSizeName.Value.ToString();
                    objSize.SeqNo     = int.Parse(this.hdnSeqNo.Value.ToString());

                    if (isNewSize)
                    {
                        int itemId = int.Parse(this.ddlSizeSet.SelectedValue.ToString());

                        SizeSetBO objSizeSet = new SizeSetBO(this.ObjContext);
                        objSizeSet.ID = itemId;
                        objSizeSet.GetObject();

                        objSizeSet.SizesWhereThisIsSizeSet.Add(objSize);
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while processing Sizes", ex);
            }
        }
        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;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Process the page data.
        /// </summary>

        private void ProcessForm(int queryId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    if (!isDelete)
                    {
                        SizeSetBO objSizeSet = new SizeSetBO(this.ObjContext);
                        if (queryId > 0)
                        {
                            objSizeSet.ID = queryId;
                            objSizeSet.GetObject();
                        }

                        List <int> lstSizeIds = objSizeSet.SizesWhereThisIsSizeSet.Select(o => o.ID).ToList();

                        this.dgAddEditSizes.AllowPaging = false;
                        foreach (DataGridItem item in this.dgAddEditSizes.Items)
                        {
                            //HiddenField hdnSizeID = (HiddenField)item.FindControl("hdnSizeID");
                            Literal  lblID        = (Literal)item.FindControl("lblID");
                            TextBox  txtSizeName  = (TextBox)item.FindControl("txtSizeName");
                            TextBox  txtSeqNo     = (TextBox)item.FindControl("txtSeqNo");
                            CheckBox chkIsDefault = (CheckBox)item.FindControl("chkIsDefault");
                            int      sizeId       = int.Parse(lblID.Text);
                            SizeBO   objSize      = new SizeBO(this.ObjContext);

                            if (sizeId > 0 && lstSizeIds.Contains(sizeId)) // edit
                            {
                                objSize.ID = sizeId;
                                objSize.GetObject();

                                objSize.SizeSet   = int.Parse(ddlSizeSet.SelectedItem.Value);
                                objSize.IsDefault = chkIsDefault.Checked;
                                objSize.SizeName  = txtSizeName.Text;
                                objSize.SeqNo     = int.Parse(txtSeqNo.Text);
                            }
                            else // new
                            {
                                objSize.SizeSet   = int.Parse(ddlSizeSet.SelectedItem.Value);
                                objSize.IsDefault = chkIsDefault.Checked;
                                objSize.SizeName  = txtSizeName.Text;
                                objSize.SeqNo     = int.Parse(txtSeqNo.Text);
                                objSizeSet.SizesWhereThisIsSizeSet.Add(objSize);
                            }

                            //if (lstSizeIds.Count == 0 || !lstSizeIds.Contains(sizeId)) //New Size
                            //{
                            //    //Label lblSizeName = (Label)item.FindControl("lblSizeName");
                            //    //Label lblSeqNo = (Label)item.FindControl("lblSeqNo");
                            //    //Label lblSizeSet = (Label)item.FindControl("lblSizeSet");

                            //    //SizeBO objSize = new SizeBO(this.ObjContext);

                            //    //objSize.SizeSet = int.Parse(ddlSizeSet.SelectedItem.Value);
                            //    //objSize.SizeName = lblSizeName.Text;
                            //    //objSize.SeqNo = int.Parse(lblSeqNo.Text);
                            //    //objSizeSet.SizesWhereThisIsSizeSet.Add(objSize);

                            //    //Label lblSizeSet = (Label)item.FindControl("lblSizeSet");


                            //}

                            //lstSizeIds.Remove(sizeId);
                        }

                        //if (lstSizeIds.Count > 0)
                        //{
                        //    foreach (int sizeId in lstSizeIds)
                        //    {
                        //        SizeBO objSize = new SizeBO(this.ObjContext);
                        //        objSize.ID = sizeId;
                        //        objSize.GetObject();

                        //        objSizeSet.SizesWhereThisIsSizeSet.Remove(objSize);
                        //        objSize.Delete();
                        //    }
                        //}

                        this.ObjContext.SaveChanges();
                    }
                    else //Delete Size
                    {
                        SizeBO objSize = new SizeBO(this.ObjContext);
                        if (queryId > 0)
                        {
                            objSize.ID = queryId;
                            objSize.GetObject();

                            objSize.Delete();
                            this.ObjContext.SaveChanges();
                        }
                    }

                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                //IndicoLogging.log("Error occured while Adding the Item", ex);
            }
        }