コード例 #1
0
        protected void btnSaveFabric_Click(object sender, EventArgs e)
        {
            int fabric = int.Parse(this.ddlEditFabric.SelectedValue);
            int price  = int.Parse(this.hdnSelectedID.Value);

            if (fabric > 0 && price > 0)
            {
                try
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        PriceBO objPrice = new PriceBO(this.ObjContext);
                        objPrice.ID = price;
                        objPrice.GetObject();

                        objPrice.FabricCode   = fabric;
                        objPrice.Modifier     = LoggedUser.ID;
                        objPrice.ModifiedDate = DateTime.Now;

                        this.ObjContext.SaveChanges();
                        ts.Complete();
                    }
                }
                catch (Exception ex)
                {
                    IndicoLogging.log.Error("Error occured while Changing Fabric in AddPatternFabric.aspx page", ex);
                }
            }
            this.Search();
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int price = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["priceid"]);

            if (price > 0)
            {
                try
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        PriceBO objPrice = new PriceBO(this.ObjContext);
                        objPrice.ID = price;
                        objPrice.GetObject();

                        objPrice.Remarks      = txtAddNote.Text;
                        objPrice.Modifier     = LoggedUser.ID;
                        objPrice.ModifiedDate = DateTime.Now;
                        ObjContext.SaveChanges();
                        ts.Complete();
                    }
                }
                catch (Exception ex)
                {
                    IndicoLogging.log.Error("Error occured while ading/updating note(btnSaveNote_Click()) AddPatternFabricPricePage", ex);
                }
            }
            ViewState["populateaddNewNote"] = false;
            this.PopulatePatternFabrics();
        }
コード例 #3
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(int fabricCode)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    List <PriceBO> lstPrices = (from o in (new PriceBO()).SearchObjects()
                                                where o.Pattern == this.ActivePattern.ID &&
                                                o.FabricCode == fabricCode
                                                select o).ToList();
                    PriceBO objPrice = new PriceBO(this.ObjContext);
                    if (lstPrices.Count > 0)
                    {
                        objPrice.ID = lstPrices[0].ID;
                        objPrice.GetObject();
                    }
                    else
                    {
                        objPrice.Pattern            = int.Parse(this.hdnPattern.Value.Trim());
                        objPrice.FabricCode         = fabricCode;
                        objPrice.EnableForPriceList = false;

                        objPrice.Creator     = this.LoggedUser.ID;
                        objPrice.CreatedDate = Convert.ToDateTime(DateTime.Now.ToString("g"));
                    }
                    objPrice.Modifier     = this.LoggedUser.ID;
                    objPrice.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToString("g"));

                    this.ObjContext.SaveChanges();

                    if (lstPrices.Count == 0)
                    {
                        foreach (int priceLevel in (new PriceLevelBO()).GetAllObject().Select(o => o.ID))
                        {
                            PriceLevelCostBO objPriceLevelCost = new PriceLevelCostBO(this.ObjContext);

                            objPriceLevelCost.FactoryCost  = 0;
                            objPriceLevelCost.IndimanCost  = 0;
                            objPriceLevelCost.Creator      = this.LoggedUser.ID;
                            objPriceLevelCost.CreatedDate  = DateTime.Now;
                            objPriceLevelCost.Modifier     = this.LoggedUser.ID;
                            objPriceLevelCost.ModifiedDate = DateTime.Now;
                            objPriceLevelCost.PriceLevel   = priceLevel;
                            objPrice.PriceLevelCostsWhereThisIsPrice.Add(objPriceLevelCost);
                            this.ObjContext.SaveChanges();
                        }
                    }
                    //this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                // Log the error
                IndicoLogging.log.Error("Error occured while Adding the Item", ex);
            }
        }
コード例 #4
0
        protected void dgPrices_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is IGrouping <int, PriceBO> )
            {
                var     lstPrices = ((IGrouping <int, PriceBO>)item.DataItem).ToList();
                PriceBO objPrice  = lstPrices[0];
                if (sportsCategory == string.Empty || (sportsCategory != objPrice.objPattern.objCoreCategory.Name))
                {
                    Label lblSportsCategory = (Label)item.FindControl("lblSportsCategory");
                    lblSportsCategory.Text = objPrice.objPattern.objCoreCategory.Name;
                    sportsCategory         = objPrice.objPattern.objCoreCategory.Name;
                }

                Label lblPatternNo = (Label)item.FindControl("lblPatternNo");
                lblPatternNo.Text = objPrice.objPattern.Number;

                Label lblOtherCategories = (Label)item.FindControl("lblOtherCategories");
                lblOtherCategories.Text = (objPrice.objPattern.PatternOtherCategorysWhereThisIsPattern.Count > 0) ? objPrice.objPattern.PatternOtherCategorysWhereThisIsPattern[0].Name : "";

                Label lblNickName = (Label)item.FindControl("lblNickName");
                lblNickName.Text = objPrice.objPattern.NickName;

                HtmlContainerControl dvFabricCodes = (HtmlContainerControl)item.FindControl("dvFabricCodes");
                for (int i = 0; i < lstPrices.Count; i++)
                {
                    if (i == 0)
                    {
                        dvFabricCodes.InnerHtml += "<Label>" + lstPrices[i].objFabricCode.Name + "</label>";
                    }
                    else
                    {
                        dvFabricCodes.InnerHtml += "<Label class=\"iseparator\">" + lstPrices[i].objFabricCode.Name + "</label>";
                    }
                }

                Label lblModifiedDate = (Label)item.FindControl("lblModifiedDate");
                lblModifiedDate.Text = objPrice.ModifiedDate.ToString("MMM dd yyyy");

                HyperLink linkEditFactoryCost = (HyperLink)item.FindControl("linkEditFactoryCost");
                linkEditFactoryCost.NavigateUrl = "/EditFactoryPrice.aspx?id=" + objPrice.Pattern.ToString();
                linkEditFactoryCost.ToolTip     = "Edit Factory Cost";

                HyperLink linkEditIndimanCost = (HyperLink)item.FindControl("linkEditIndimanCost");
                linkEditIndimanCost.NavigateUrl = "/EditIndimanPrice.aspx?id=" + objPrice.Pattern.ToString();
                linkEditIndimanCost.ToolTip     = "Edit Manufature Cost";

                HyperLink linkEditIndicoCost = (HyperLink)item.FindControl("linkEditIndicoCost");
                linkEditIndicoCost.NavigateUrl = "/EditIndicoPrice.aspx?pat=" + objPrice.Pattern.ToString();
                linkEditIndicoCost.ToolTip     = "Edit Sales Cost";

                HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete");
                linkDelete.Attributes.Add("qid", objPrice.Pattern.ToString());
            }
        }
コード例 #5
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int fabricCode = int.Parse(this.hdnSelectedID.Value.Trim());

            if (Page.IsValid)
            {
                try
                {
                    List <PriceBO> lstPrices = (from o in (new PriceBO()).SearchObjects()
                                                where o.Pattern == int.Parse(this.hdnPattern.Value.Trim()) &&
                                                o.FabricCode == fabricCode
                                                select o).ToList();
                    if (lstPrices.Count > 0)
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            PriceBO objPrice = new PriceBO(this.ObjContext);
                            objPrice.ID = lstPrices[0].ID;
                            objPrice.GetObject();

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

                                foreach (DistributorPriceLevelCostBO itemDPLC in objPLC.DistributorPriceLevelCostsWhereThisIsPriceLevelCost)
                                {
                                    DistributorPriceLevelCostBO objDPLC = new DistributorPriceLevelCostBO(this.ObjContext);
                                    objDPLC.ID = itemDPLC.ID;
                                    objDPLC.GetObject();

                                    objDPLC.Delete();
                                }
                                objPLC.Delete();
                            }
                            objPrice.Delete();

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

                    // Populate active pattern fabrics
                    this.PopulatePatternFabrics();
                }
                catch (Exception ex)
                {
                    // Log the error
                    IndicoLogging.log.Error("btnDelete_Click : Error occured while Adding the Item", ex);
                }
            }
        }
コード例 #6
0
ファイル: BusinessManager.cs プロジェクト: andremn/SPS
 private BusinessManager()
 {
     this.montlyClientBO = new ClientBO();
     this.collaboratorBO = new CollaboratorBO();
     this.localManagerBO = new LocalManagerBO();
     this.globalManagerBO = new GlobalManagerBO();
     this.parkingBO = new ParkingBO();
     this.parkingSpaceBO = new ParkingSpaceBO();
     this.priceBO = new PriceBO();
     this.addressBO = new AddressBO();
     this.tagBO = new TagBO();
     this.plateBO = new PlateBO();
     this.usageRecordsBO = new UsageRecordBO();
 }
コード例 #7
0
        protected void dgSelectedFabrics_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is FabricCodeBO)
            {
                FabricCodeBO objFabric = (FabricCodeBO)item.DataItem;
                PriceBO      objPrice  = (new PriceBO()).GetAllObject().SingleOrDefault(o => o.Pattern == int.Parse(this.hdnPattern.Value) && o.FabricCode == objFabric.ID);

                Literal litSetCost = (Literal)item.FindControl("litSetCost");
                litSetCost.Text = "Set cost for all levels";

                HtmlInputText txtSetCost = (HtmlInputText)item.FindControl("txtSetCost");

                HtmlControl olPriceTable = (HtmlControl)item.FindControl("olPriceTable");
                HtmlButton  btnApply     = (HtmlButton)item.FindControl("btnApply");
                btnApply.Attributes.Add("table", olPriceTable.ClientID);

                HtmlButton btnUpdate = (HtmlButton)item.FindControl("btnUpdate");
                btnUpdate.Attributes.Add("qid", objFabric.ID.ToString());
                btnUpdate.InnerText = (objPrice != null) ? "Update" : "Add";

                HtmlButton btnDelete = (HtmlButton)item.FindControl("btnDelete");
                btnDelete.Attributes.Add("qid", objFabric.ID.ToString());

                Repeater rptPriceLevelCost = (Repeater)item.FindControl("rptPriceLevelCost");
                if (objPrice != null) // Update
                {
                    decimal factoryCost = objPrice.PriceLevelCostsWhereThisIsPrice.Select(o => o.FactoryCost).Aggregate((x, y) => x + y);
                    isEnableIndimanCost = (factoryCost > 0);

                    litSetCost.Visible = isEnableIndimanCost;
                    txtSetCost.Visible = isEnableIndimanCost;
                    btnApply.Visible   = isEnableIndimanCost;
                    btnUpdate.Visible  = isEnableIndimanCost;

                    rptPriceLevelCost.DataSource = objPrice.PriceLevelCostsWhereThisIsPrice;
                }
                else // Add New
                {
                    litSetCost.Visible = false;
                    txtSetCost.Visible = false;
                    btnApply.Visible   = false;

                    List <DistributorPriceMarkupBO> lstPriceMarkups = (new DistributorPriceMarkupBO()).GetAllObject().Where(o => (int)o.Distributor == int.Parse(this.ddlDistributors.SelectedValue.Trim())).ToList();
                    rptPriceLevelCost.DataSource = lstPriceMarkups;
                }
                rptPriceLevelCost.DataBind();
            }
        }
コード例 #8
0
        protected void btnAddNote_Click(object sender, EventArgs e)
        {
            int price = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["pid"]);

            btnSave.Attributes.Add("priceid", price.ToString());
            if (price > 0)
            {
                PriceBO objPrice = new PriceBO();
                objPrice.ID = price;
                objPrice.GetObject();
                lblNoteHeading.Text = string.IsNullOrEmpty(objPrice.Remarks) ? "Add New Note" : "Edit Note";
                txtAddNote.Text     = objPrice.Remarks;
            }
            ViewState["populateaddNewNote"] = true;
        }
コード例 #9
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);
            }
        }
コード例 #10
0
        protected void dgSelectedFabrics_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is FabricCodeBO)
            {
                FabricCodeBO objFabric = (FabricCodeBO)item.DataItem;
                PriceBO      objPrice  = (new PriceBO()).GetAllObject().SingleOrDefault(o => o.Pattern == int.Parse(this.hdnPattern.Value) && o.FabricCode == objFabric.ID);

                Literal    lblCreator    = (Literal)item.FindControl("lblCreator");
                Literal    lblCreateDate = (Literal)item.FindControl("lblCreateDate");
                LinkButton btnAddNote    = (LinkButton)item.FindControl("btnAddNote");
                Literal    litModifier   = (Literal)item.FindControl("litModifier");
                Literal    litMofiedDate = (Literal)item.FindControl("litMofiedDate");
                HyperLink  linkDelete    = (HyperLink)item.FindControl("linkDelete");
                HyperLink  linkEdit      = (HyperLink)item.FindControl("linkEdit");

                if (objPrice != null)
                {
                    lblCreator.Text    = objPrice.objCreator.GivenName + " " + objPrice.objCreator.FamilyName;
                    lblCreateDate.Text = objPrice.CreatedDate.ToString("dd MMMM yyyy");
                    litModifier.Text   = objPrice.objModifier.GivenName + " " + objPrice.objModifier.FamilyName;
                    litMofiedDate.Text = objPrice.ModifiedDate.ToString("dd MMMM yyyy");
                    btnAddNote.Attributes.Add("pid", objPrice.ID.ToString());
                    linkDelete.Attributes.Add("qid", objPrice.ID.ToString());
                    linkEdit.Attributes.Add("pid", objPrice.ID.ToString());
                    linkEdit.Attributes.Add("fid", objFabric.ID.ToString());
                }
                else
                {
                    lblCreator.Text    = LoggedUser.GivenName + " " + LoggedUser.FamilyName;
                    lblCreateDate.Text = DateTime.Now.ToString("dd MMMM yyyy");
                    litModifier.Text   = LoggedUser.GivenName + " " + LoggedUser.FamilyName;
                    litMofiedDate.Text = DateTime.Now.ToString("dd MMMM yyyy");
                }
            }
        }
コード例 #11
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int priceID = int.Parse(this.hdnSelectedID.Value.Trim());

            if (Page.IsValid)
            {
                try
                {
                    ReturnIntViewBO objReturnInt = new ReturnIntViewBO();
                    objReturnInt = PriceBO.DeletePrice(priceID);
                    if (objReturnInt.RetVal == 0)
                    {
                        IndicoLogging.log.Error("btnDelete_Click : Error occured while Deleting the Price AddPatternFabric.aspx, SP_DeletePrice ");
                    }
                    // Populate active pattern fabrics
                    this.PopulatePatternFabrics();
                }
                catch (Exception ex)
                {
                    // Log the error
                    IndicoLogging.log.Error("btnDelete_Click : Error occured while Deleting the Price AddPatternFabric.aspx", ex);
                }
            }
        }
コード例 #12
0
        private void PopulateDataGrid()
        {
            // Hide Controls
            this.dvEmptyContent.Visible        = false;
            this.dvEmptyContentFactory.Visible = false;
            this.dvDataContent.Visible         = false;
            this.dvNoSearchResult.Visible      = false;

            // Search text
            string searchText = this.txtSearch.Text.ToLower().Trim();
            //int distributor = int.Parse(this.ddlFilterBy.SelectedValue);

            // Populate Items
            PriceBO objPrice = new PriceBO();

            List <IGrouping <int, PriceBO> > lstPrices = new List <IGrouping <int, PriceBO> >();

            if ((searchText != string.Empty) && (searchText != "search"))
            {
                lstPrices = (from o in objPrice.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                             where o.objPattern.Number.ToLower().Contains(searchText)
                             orderby o.Pattern
                             group o by o.Pattern into g
                             select g).ToList();
            }
            else
            {
                lstPrices = (from o in objPrice.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                             orderby o.objPattern.objCoreCategory.Name
                             group o by o.Pattern into g
                             select g).ToList();
            }

            if (lstPrices.Count > 0)
            {
                this.dgPrices.AllowPaging = (lstPrices.Count > this.dgPrices.PageSize);
                this.dgPrices.DataSource  = lstPrices;
                this.dgPrices.DataBind();

                this.dvDataContent.Visible = true;
            }
            else if ((searchText != string.Empty && searchText != "search"))
            {
                this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " " : string.Empty);

                this.dvDataContent.Visible    = true;
                this.dvNoSearchResult.Visible = true;
            }
            else
            {
                this.dvEmptyContentFactory.Visible = (this.LoggedCompany.Type == 1);
                this.dvEmptyContent.Visible        = !(this.dvEmptyContentFactory.Visible);
                this.btnAddPrice.Visible           = false;
            }

            switch (this.LoggedCompanyType)
            {
            case CompanyType.Factory:
            {
                //this.dgPrices.Columns[7].Visible = false;
                // this.dgPrices.Columns[8].Visible = false;
                this.btnAddPrice.Visible = false;
                break;
            }

            case CompanyType.Sales:
            {
                this.dgPrices.Columns[6].Visible = false;
                this.dgPrices.Columns[7].Visible = false;
                break;
            }

            case CompanyType.Manufacturer:
                break;

            case CompanyType.Distributor:
                break;

            case CompanyType.Client:
                break;

            default:
                break;
            }
            this.dgPrices.Visible = (lstPrices.Count > 0);
        }
コード例 #13
0
        /// <summary>
        /// Process the page data.
        /// </summary>
        private void ProcessForm(Repeater dataRepeater, int fabricCode)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    this.ActivePattern.ConvertionFactor = Convert.ToDecimal(decimal.Parse(this.txtConvertionFactor.Text.Trim()).ToString("0.00"));
                    this.ActivePattern.PriceRemarks     = this.txtRemarks.Text.Trim();

                    List <PriceBO> lstPrices = (from o in (new PriceBO()).SearchObjects()
                                                where o.Pattern == this.ActivePattern.ID &&
                                                o.FabricCode == fabricCode
                                                select o).ToList();
                    PriceBO objPrice = new PriceBO(this.ObjContext);
                    if (lstPrices.Count > 0)
                    {
                        objPrice.ID = lstPrices[0].ID;
                        objPrice.GetObject();
                    }
                    else
                    {
                        objPrice.Pattern    = int.Parse(this.hdnPattern.Value.Trim());
                        objPrice.FabricCode = fabricCode;

                        objPrice.Creator     = this.LoggedUser.ID;
                        objPrice.CreatedDate = Convert.ToDateTime(DateTime.Now.ToString("g"));
                    }
                    objPrice.Modifier     = this.LoggedUser.ID;
                    objPrice.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToString("g"));

                    foreach (RepeaterItem item in dataRepeater.Items)
                    {
                        HiddenField hdnCellID   = (HiddenField)item.FindControl("hdnCellID");
                        TextBox     txtCIFPrice = (TextBox)item.FindControl("txtCIFPrice");

                        int priceLevel     = int.Parse(txtCIFPrice.Attributes["level"].ToString().Trim());
                        int priceLevelCost = int.Parse(hdnCellID.Value.Trim());

                        PriceLevelCostBO objPriceLevelCost = new PriceLevelCostBO(this.ObjContext);
                        if (priceLevelCost > 0)
                        {
                            objPriceLevelCost.ID = priceLevelCost;
                            objPriceLevelCost.GetObject();
                        }
                        else
                        {
                            objPriceLevelCost.PriceLevel = priceLevel;
                            objPrice.PriceLevelCostsWhereThisIsPrice.Add(objPriceLevelCost);
                        }
                        objPriceLevelCost.IndimanCost = Convert.ToDecimal(decimal.Parse(txtCIFPrice.Text.Trim()).ToString("0.00"));
                    }

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