Ejemplo n.º 1
0
        private void ProcessForm(int sizesetsId, bool isDelete)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    SizeSetBO objSizeSets = new SizeSetBO(this.ObjContext);
                    if (sizesetsId > 0)
                    {
                        objSizeSets.ID = sizesetsId;
                        objSizeSets.GetObject();
                        objSizeSets.Name        = this.txtSizeSetName.Text;
                        objSizeSets.Description = this.txtDescription.Text;

                        if (isDelete)
                        {
                            objSizeSets.Delete();
                        }
                    }
                    else
                    {
                        objSizeSets.Name        = this.txtSizeSetName.Text;
                        objSizeSets.Description = this.txtDescription.Text;
                        objSizeSets.Add();
                    }

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }
        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;
        }
Ejemplo n.º 3
0
        private void PopulateSize(int sizeSetId)
        {
            SizeSetBO objSizeSet = new SizeSetBO();

            objSizeSet.ID = sizeSetId;
            objSizeSet.GetObject();

            foreach (SizeBO size in objSizeSet.SizesWhereThisIsSizeSet)
            {
                if (this.Sizes.Where(o => o.ID == size.ID).ToList().Count == 0)
                {
                    this.Sizes.Add(size);
                    Session["sizes"] = this.Sizes;
                }
            }

            if (this.Sizes.Count > 0)
            {
                this.dgAddEditSizes.DataSource = this.Sizes;
                dgAddEditSizes.EditItemIndex   = 0;
                this.dgAddEditSizes.DataBind();
            }

            if (this.Sizes.Count == 0)
            {
                //this.dvEmptyContentAccessory.Attributes.Add("style", "display:block");
            }
            else
            {
                //this.dvEmptyContentAccessory.Attributes.Add("style", "display:none");
            }
            dvAddEditSizes.Visible = (this.Sizes.Count > 0);
        }
Ejemplo n.º 4
0
        protected void btnAddSizes_Click(object sender, EventArgs e)
        {
            if (this.IsNotRefresh)
            {
                this.ddlSizeSet.Items.Clear();
                this.ddlSizeSet.Items.Add(new ListItem("Select Size Set", "0"));

                List <int> lstExistingItems = (new SizeBO()).SearchObjects().GroupBy(o => o.SizeSet).Select(m => m.First().SizeSet).ToList();
                List <int> lstNewItems      = (new SizeSetBO()).SearchObjects().Select(o => o.ID).Except(lstExistingItems).ToList();

                foreach (int item in lstNewItems)
                {
                    SizeSetBO objSizeSet = new SizeSetBO();
                    objSizeSet.ID = item;
                    objSizeSet.GetObject();

                    this.ddlSizeSet.Items.Add(new ListItem(objSizeSet.Name, objSizeSet.ID.ToString()));
                }

                this.dgAddEditSizes.DataSource = null;
                this.dgAddEditSizes.DataBind();

                this.hdnIsNewSizeSet.Value   = "1";
                ViewState["IsPopulateModel"] = true;
            }
            else
            {
                ViewState["IsPopulateModel"] = false;
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
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);
            }
        }