private PromotionUsage UpdatePromotionUsage(ICollection <PromotionUsage> currentUsages, Discount discount) { var usage = currentUsages.FirstOrDefault(x => x.PromotionId == discount.PromotionId); if (usage != null) { usage.Status = (int)UsageStatus; usage.UsageDate = DateTime.UtcNow; } else { usage = new PromotionUsage { CouponCode = discount.DiscountCode, MemberId = CustomerSessionService.CustomerSession.CustomerId, OrderGroupId = CurrentOrderGroup.OrderGroupId, PromotionId = discount.PromotionId, Status = (int)UsageStatus, UsageDate = DateTime.UtcNow }; //Need to add here too to avoid duplicates currentUsages.Add(usage); MarketingRepository.Add(usage); } return(usage); }
private void UpdateMK_Click(object sender, EventArgs e) { if (this.textBox3.Text == "" || this.textBox4.Text == "") { MessageBox.Show("Insert data"); } else { MarketingR i = new MarketingR(); i.CampaignId = Convert.ToInt32(this.textBox3.Text); i.Budget = Convert.ToInt32(this.textBox4.Text); FinanceRepository fr = new FinanceRepository(); if (fr.UpdateBudget(i)) { MarketingRepository mr = new MarketingRepository(); List <MarketingR> iList = mr.GetAllApprovedCampaignAnd(); this.dataGrid2.DataSource = iList; this.textBox3.Text = ""; this.textBox4.Text = ""; } else { MessageBox.Show("Insufficient Balance"); // MessageBox.Show("Can Not Update Campaign", "Update Error"); } } }
private void deleteBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "") { MessageBox.Show("Insert the data"); } else { string campaignId = this.textBox1.Text; MarketingRepository mr = new MarketingRepository(); if (mr.Delete(campaignId)) { List <MarketingR> iList = mr.GetAllCampaign(); this.dataGrid1.DataSource = iList; this.textBox1.Text = ""; this.textBox2.Text = ""; this.textBox3.Text = ""; this.textBox4.Text = ""; this.textBox5.Text = ""; this.dateTimePicker1.Text = ""; this.dateTimePicker2.Text = ""; } else { MessageBox.Show("Can Not Delete Campaign", "Delete Error"); } } }
private void button3_Click(object sender, EventArgs e) { if (this.textBox7.Text == "" || this.textBox9.Text == "" || this.textBox10.Text == "") { MessageBox.Show("Insert the data"); } else { string id = this.textBox7.Text; double runningCost = Convert.ToDouble(this.textBox9.Text); string report = this.textBox10.Text; MarketingRepository mr = new MarketingRepository(); if (mr.UpdateCost(id, runningCost, report)) { List <MarketingR> iList = mr.GetAllApprovedCampaign(); this.dataGrid2.DataSource = iList; this.textBox7.Text = ""; this.textBox9.Text = ""; this.textBox10.Text = ""; } else { MessageBox.Show("Can Not Update Campaign", "Update Error"); } } }
private void searchBtn_Click(object sender, EventArgs e) { string text = this.searchTBox.Text; MarketingRepository mr = new MarketingRepository(); List <MarketingR> iList = mr.searchCampaign(text); this.dataGrid1.DataSource = iList; }
private PromotionReward AddCatalogReward(Promotion promotion, decimal amount, RewardAmountType amountType) { var promotionReward = new CatalogItemReward { Amount = amount, AmountTypeId = amountType.GetHashCode(), PromotionId = promotion.PromotionId }; MarketingRepository.Add(promotionReward); MarketingRepository.UnitOfWork.Commit(); return(promotionReward); }
private void dashBoardTab_Click(object sender, EventArgs e) { this.dataGrid1.Visible = false; this.dataGrid.Visible = false; this.groupBox1.Visible = false; this.groupBox2.Visible = false; this.groupBox3.Visible = true; MarketingRepository mr = new MarketingRepository(); this.totalCampaigns.Text = "Total Campaigns : " + Convert.ToString(mr.countAllCampaigns()); this.appCampaign.Text = "Approved Campaigns : " + Convert.ToString(mr.countAllApprovedCampaigns("Approved")); }
private void approvedTab_Click(object sender, EventArgs e) { this.dataGrid.Visible = false; this.dataGrid1.Visible = false; this.dataGrid2.Visible = true; this.groupBox1.Visible = true; this.groupBox2.Visible = true; this.groupBox3.Visible = false; MarketingRepository mr = new MarketingRepository(); List <MarketingR> allCampaign = mr.GetAllApprovedCampaign(); this.dataGrid2.DataSource = allCampaign; }
private Promotion AddCatalogPromotion(string catalogId, string expression, string promotionName = "test") { var promotion = new CatalogPromotion { Name = promotionName, CatalogId = catalogId, PredicateSerialized = expression, Status = "Active", StartDate = DateTime.UtcNow, }; MarketingRepository.Add(promotion); MarketingRepository.UnitOfWork.Commit(); return(promotion); }
private void marketingAllowTab_Click(object sender, EventArgs e) { this.groupBox1.Visible = false; this.groupBox2.Visible = true; this.groupBox3.Visible = false; this.groupBox4.Visible = false; this.dataGrid.Visible = false; this.dataGrid2.Visible = true; this.dataGrid3.Visible = false; MarketingRepository mr = new MarketingRepository(); List <MarketingR> allResult = mr.GetAllApprovedCampaignAnd(); this.dataGrid2.DataSource = allResult; }
private void insertBtn_Click(object sender, EventArgs e) { if (this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "") { MessageBox.Show("Please insert data"); } else { //(ProductName,ProductId,Volume,Price,Store,Category,Tax) MarketingR i = new MarketingR(); i.CampaignName = this.textBox2.Text; i.Objective = this.textBox3.Text; i.Placement = this.textBox4.Text; i.EmployeeName = this.textBox5.Text; i.LaunchDate = this.dateTimePicker1.Value.ToShortDateString(); i.EndDate = this.dateTimePicker2.Value.ToShortDateString(); i.RunningCost = 0; i.Report = ""; i.Budget = 0; i.Status = "Not Approved"; MarketingRepository mr = new MarketingRepository(); if (mr.Insert(i)) { List <MarketingR> iList = mr.GetAllCampaign(); this.dataGrid1.DataSource = iList; this.textBox1.Text = ""; this.textBox2.Text = ""; this.textBox3.Text = ""; this.textBox4.Text = ""; this.textBox5.Text = ""; this.dateTimePicker1.Text = ""; this.dateTimePicker2.Text = ""; this.comboBox1.Text = ""; } else { MessageBox.Show("Can Not Insert Campaign", "Insert Error"); } } }
private void updateBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "") { MessageBox.Show("Insert the data"); } else { MarketingR i = new MarketingR(); i.CampaignId = Convert.ToInt32(this.textBox1.Text); i.CampaignName = this.textBox2.Text; i.Objective = this.textBox3.Text; i.Placement = this.textBox4.Text; i.EmployeeName = this.textBox5.Text; i.LaunchDate = this.dateTimePicker1.Value.ToShortDateString(); i.EndDate = this.dateTimePicker2.Value.ToShortDateString(); i.RunningCost = 0; i.Report = ""; i.Budget = 0; i.Status = this.comboBox1.GetItemText(this.comboBox1.SelectedItem); MarketingRepository mr = new MarketingRepository(); if (mr.Update(i)) { List <MarketingR> iList = mr.GetAllCampaign(); this.dataGrid1.DataSource = iList; this.textBox1.Text = ""; this.textBox2.Text = ""; this.textBox3.Text = ""; this.textBox4.Text = ""; this.textBox5.Text = ""; this.comboBox1.Text = ""; this.dateTimePicker1.Text = ""; this.dateTimePicker2.Text = ""; } else { MessageBox.Show("Can Not Update Campaign", "Update Error"); } } }
private void campaignsTab_Click(object sender, EventArgs e) { this.dataGrid.Visible = false; this.dataGrid1.Visible = true; this.dataGrid2.Visible = false; this.groupBox1.Visible = true; this.groupBox2.Visible = false; this.groupBox3.Visible = false; MarketingRepository mr = new MarketingRepository(); List <MarketingR> allCampaign = mr.GetAllCampaign(); this.dataGrid1.DataSource = allCampaign; dataGrid1.Columns[7].Visible = false; dataGrid1.Columns[8].Visible = false; dataGrid1.Columns[9].Visible = false; }
private void DashBoardTab_Click(object sender, EventArgs e) { this.groupBox1.Visible = false; this.groupBox2.Visible = false; this.groupBox3.Visible = false; this.groupBox4.Visible = true; this.dataGrid.Visible = false; this.dataGrid2.Visible = false; this.dataGrid3.Visible = false; MarketingRepository mr = new MarketingRepository(); InventoryRepository ir = new InventoryRepository(); EmployeeRepository er = new EmployeeRepository(); this.marketingAllowanceLabel.Text = "Pending Marketing Allowence : " + Convert.ToString(mr.countAllApprovedCampaignsAnd("Approved")); this.purchaseAllowanceLabel.Text = "Pending Product Purchase : " + Convert.ToString(ir.countAllInventoryAnd()); this.salaryAllowanceLabel.Text = "Pending Salary Allowence : " + Convert.ToString(er.countAllEmployeeAnd()); }
public Finance() { InitializeComponent(); this.groupBox1.Visible = false; this.groupBox2.Visible = false; this.groupBox3.Visible = false; this.groupBox4.Visible = true; this.dataGrid.Visible = false; this.dataGrid2.Visible = false; this.dataGrid3.Visible = false; MarketingRepository mr = new MarketingRepository(); InventoryRepository ir = new InventoryRepository(); EmployeeRepository er = new EmployeeRepository(); this.marketingAllowanceLabel.Text = "Pending Marketing Allowence : " + Convert.ToString(mr.countAllApprovedCampaignsAnd("Approved")); this.purchaseAllowanceLabel.Text = "Pending Product Purchase : " + Convert.ToString(ir.countAllInventoryAnd()); this.salaryAllowanceLabel.Text = "Pending Salary Allowence : " + Convert.ToString(er.countAllEmployeeAnd()); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); if (ServiceLocator == null) { return; } if (CurrentOrderGroup == null || CurrentOrderGroup.OrderForms.Count == 0) { return; } //Remove usages for current orderGroup var usages = MarketingRepository.PromotionUsages.Where(x => x.OrderGroupId == CurrentOrderGroup.OrderGroupId && x.Status != (int)PromotionUsageStatus.Used).ToList(); foreach (var promotionUsage in usages) { MarketingRepository.Remove(promotionUsage); } var currentUsages = new List <PromotionUsage>(); foreach (var orderForm in CurrentOrderGroup.OrderForms) { //create records for order form discounts orderForm.Discounts.ToList().ForEach(formDiscount => UpdatePromotionUsage(currentUsages, formDiscount)); //create records for line item discounts orderForm.LineItems.SelectMany(x => x.Discounts).ToList().ForEach(lineItemDiscount => UpdatePromotionUsage(currentUsages, lineItemDiscount)); //create records for shipment discounts orderForm.Shipments.SelectMany(x => x.Discounts).ToList().ForEach(shipmentDiscount => UpdatePromotionUsage(currentUsages, shipmentDiscount)); } MarketingRepository.UnitOfWork.Commit(); }
public Marketing() { InitializeComponent(); this.dataGrid1.Visible = false; this.dataGrid.Visible = false; this.groupBox1.Visible = false; this.groupBox2.Visible = false; this.groupBox3.Visible = true; this.textBox1.Enabled = false; this.textBox7.Enabled = false; this.textBox8.Enabled = false; MarketingRepository mr = new MarketingRepository(); this.totalCampaigns.Text = "Total Campaigns : " + Convert.ToString(mr.countAllCampaigns()); this.appCampaign.Text = "Approved Campaigns : " + Convert.ToString(mr.countAllApprovedCampaigns("Approved")); }
public AdminDashboard() { InitializeComponent(); //marketing Info MarketingRepository mr = new MarketingRepository(); // this.totalCampaigns.Text = "Total Campaigns : " + Convert.ToString(mr.countAllCampaigns()); // this.appCampaign.Text = "Approved Campaigns : " + Convert.ToString(mr.countAllApprovedCampaigns("Approved")); //Hr Info EmployeeRepository m = new EmployeeRepository(); /* * EmployeeRepository m = new EmployeeRepository(); * this.label123.Text += Convert.ToString(m.countAllEmployee()); * this.label129.Text += Convert.ToString(m.countEmployee("Admin")); * this.label125.Text += Convert.ToString(m.countEmployee("Sales")); * this.label127.Text += Convert.ToString(m.countEmployee("Marketing")); * this.label124.Text += Convert.ToString(m.countEmployee("Human Resource")); * this.label126.Text += Convert.ToString(m.countEmployee("Accounting")); * this.label128.Text += Convert.ToString(m.countEmployee("Finance")); * * this.label120.Text += Convert.ToString(m.countAllStatus("Full Time")); * this.label119.Text += Convert.ToString(m.countAllStatus("Probationary")); * this.label118.Text += Convert.ToString(m.countAllStatus("Intern")); * * * this.label120.Text += Convert.ToString(m.countAllStatus("Full Time")); * this.label119.Text += Convert.ToString(m.countAllStatus("Probationary")); * this.label118.Text += Convert.ToString(m.countAllStatus("Intern"));*/ this.hrGraph2.Visible = false; this.hrGraph.Series["emp"].Points.AddXY("Admin", m.countEmployee("Admin")); this.hrGraph.Series["emp"].Points.AddXY("Sales", m.countEmployee("Sales")); this.hrGraph.Series["emp"].Points.AddXY("HR", m.countEmployee("Human Resource")); this.hrGraph.Series["emp"].Points.AddXY("IT", m.countEmployee("IT")); this.hrGraph.Series["emp"].Points.AddXY("Accounts", m.countEmployee("Accounting")); this.hrGraph.Series["emp"].Points.AddXY("Finance", m.countEmployee("Finance")); this.hrGraph.Series["emp"].Points.AddXY("Marketing", m.countEmployee("Marketing")); this.hrGraph2.Series["Status"].Points.AddXY("Full Time", m.countAllStatus("Full Time")); this.hrGraph2.Series["Status"].Points.AddXY("Probationary", m.countAllStatus("Probationary")); this.hrGraph2.Series["Status"].Points.AddXY("Intern", m.countAllStatus("Intern")); //sales Info //get all the data // count the total order in groupBox3 OrderRepository or = new OrderRepository(); /* this.label117.Text = "Total Order : " + Convert.ToString(or.countAllOrder()); * this.label114.Text = "Bike : " + Convert.ToString(or.countOrder("Bike")); * this.label108.Text = "Car : " + Convert.ToString(or.countOrder("Car")); * this.label111.Text = "Cng : " + Convert.ToString(or.countOrder("Cng")); * this.label112.Text = "Microbus : " + Convert.ToString(or.countOrder("Microbus")); * this.label92.Text = "Pickup : " + Convert.ToString(or.countOrder("Pickup")); * this.label90.Text = "Truck : " + Convert.ToString(or.countOrder("Truck")); */ /* this.orderGraph.Series["Order"].Points.AddXY("Bike:" + Convert.ToString(or.countOrder("Bike")), or.countOrder("Bike")); * this.orderGraph.Series["Order"].Points.AddXY("Car:" + Convert.ToString(or.countOrder("Car")), or.countOrder("Car") ); * this.orderGraph.Series["Order"].Points.AddXY("Cng:" + Convert.ToString(or.countOrder("Cng")), or.countOrder("Cng")); * this.orderGraph.Series["Order"].Points.AddXY("Microbus:" + Convert.ToString(or.countOrder("Microbus")), or.countOrder("Microbus")); * this.orderGraph.Series["Order"].Points.AddXY("Pickup:" + Convert.ToString(or.countOrder("Pickup")), or.countOrder("Pickup")); * this.orderGraph.Series["Order"].Points.AddXY("Truck:"+ Convert.ToString(or.countOrder("Truck")), or.countOrder("Truck"));*/ this.orderGraph.Series["Order"].Points.AddXY("Bike", or.countOrder("Bike")); this.orderGraph.Series["Order"].Points.AddXY("Car", or.countOrder("Car")); this.orderGraph.Series["Order"].Points.AddXY("Cng", or.countOrder("Cng")); this.orderGraph.Series["Order"].Points.AddXY("Microbus", or.countOrder("Microbus")); this.orderGraph.Series["Order"].Points.AddXY("Pickup", or.countOrder("Pickup")); this.orderGraph.Series["Order"].Points.AddXY("Truck", or.countOrder("Truck")); //count the total Inventory in groupBox4 InventoryRepository ir = new InventoryRepository(); /* this.label73.Text = "Total Inventory : " + Convert.ToString(ir.countAllInventory()); * this.label138.Text = "Bike :" + Convert.ToString(ir.countInventory("Bike")); * this.label135.Text = "Car :" + Convert.ToString(ir.countInventory("Car")); * this.label136.Text = "Cng :" + Convert.ToString(ir.countInventory("Cng")); * this.label137.Text = "Microbus :" + Convert.ToString(ir.countInventory("Microbus")); * this.label134.Text = "Pickup :" + Convert.ToString(ir.countInventory("Pickup")); * this.label133.Text = "Truck :" + Convert.ToString(ir.countInventory("Truck")); */ this.inventoryGraph.Series["Inventory"].Points.AddXY("Bike", ir.countInventory("Bike")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Car", ir.countInventory("Car")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Cng", ir.countInventory("Cng")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Microbus", ir.countInventory("Microbus")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Pickup", ir.countInventory("Pickup")); this.inventoryGraph.Series["Inventory"].Points.AddXY("Truck", ir.countInventory("Truck")); //count all shipment ShipmentRepository sr = new ShipmentRepository(); /* this.label52.Text = "Total Shipment : " + Convert.ToString(sr.countAllShipment()); * this.label72.Text = "At Origin : " + Convert.ToString(sr.countShipment("At Origin")); * this.label66.Text = "On the Way : " + Convert.ToString(sr.countShipment("On the Way")); * this.label70.Text = "Stucked : " + Convert.ToString(sr.countShipment("Stuked")); * this.label71.Text = "At Destination : " + Convert.ToString(sr.countShipment("At Destination")); * this.label68.Text = "Shipped : " + Convert.ToString(sr.countShipment("Shipped")); */ this.shipmentGraph.Series["Shipment"].Points.AddXY("At Origin", sr.countShipment("At Origin")); this.shipmentGraph.Series["Shipment"].Points.AddXY("On the Way", sr.countShipment("On the Way")); this.shipmentGraph.Series["Shipment"].Points.AddXY("Stucked", sr.countShipment("Stuked")); this.shipmentGraph.Series["Shipment"].Points.AddXY("At Destination", sr.countShipment("At Destination")); this.shipmentGraph.Series["Shipment"].Points.AddXY("Shipped", sr.countShipment("Shipped")); //accounting AccountingRepository ar = new AccountingRepository(); // this.totalCashLabel.Text = "totalCash : " + Convert.ToString(ar.countTotalCash()); }