public bool AddSalesman(string name, string address, string city, string pc, string no, string email, int com, string remarks, string path)
        {
            try
            {
                po.Name        = name;
                po.Address     = address;
                po.City        = city;
                po.Postal_Code = pc;
                po.Contact_No  = no;
                po.Email_ID    = email;
                po.Commission  = com;
                po.Remarks     = remarks;
                po.Image       = ci.ConvertFileToByte(path);

                cmd.Salesman_Details.Add(po);
                cmd.SaveChanges();
                MessageBox.Show("Salesman Added succesfully");
                return(true);
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
        public bool AddManager(string name, string address, string city, int code, string contact, string email, int commission, string remarks, string path)
        {
            try
            {
                md.MName       = name;
                md.Address     = address;
                md.City        = city;
                md.Postal_code = code;
                md.Contact     = "+88" + contact;
                md.Email       = email;
                md.Commission  = commission;
                md.Remarks     = remarks;
                md.Image       = ci.ConvertFileToByte(path);

                cmd.Manager_details.Add(md);
                cmd.SaveChanges();

                MessageBox.Show("Manager Added succesfully");
                return(true);
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
        public ActionResult Create([Bind(Include = "VesselID,VesselName,VesselType,VesselWeight,TotalContainers")] Vessel vessel)
        {
            if (ModelState.IsValid)
            {
                db.Vessels.Add(vessel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vessel));
        }
        public ActionResult Create([Bind(Include = "Id,Name,ContactNo,Address,Email")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
        public ActionResult Create([Bind(Include = "PortID,PortName,LocationName,CountryName")] Port port)
        {
            if (ModelState.IsValid)
            {
                db.Ports.Add(port);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(port));
        }
示例#6
0
        public ActionResult Create([Bind(Include = "Id,BookingName,ShippingScheduleId,CargoId,AgentId,CreatedDate")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                db.Bookings.Add(booking);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AgentId            = new SelectList(db.AspNetUsers, "Id", "Email", booking.AgentId);
            ViewBag.ShippingScheduleId = new SelectList(db.ShippingSchedules, "ShippingScheduleID", "ShippingScheduleName", booking.ShippingScheduleId);
            ViewBag.CargoId            = new SelectList(db.Cargoes, "Id", "Name", booking.CargoId);
            return(View(booking));
        }
示例#7
0
        public ActionResult Create([Bind(Include = "Id,Name,LocationId,DestinationId,Quantity,TotalWeight,CustomerId,AgentId,RegisteredDate")] Cargo cargo)
        {
            if (ModelState.IsValid)
            {
                db.Cargoes.Add(cargo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AgentId       = new SelectList(db.AspNetUsers, "Id", "Email", cargo.AgentId);
            ViewBag.CustomerId    = new SelectList(db.Customers, "Id", "Name", cargo.CustomerId);
            ViewBag.LocationId    = new SelectList(db.Ports, "PortID", "PortName", cargo.LocationId);
            ViewBag.DestinationId = new SelectList(db.Ports, "PortID", "PortName", cargo.DestinationId);
            return(View(cargo));
        }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (pbP.Image != null)
     {
         int stock = (productDetailsBindingSource.Current as Product_Details).Stock;
         try
         {
             stock = stock + int.Parse(txtPPurchaseU.Text);
             (productDetailsBindingSource.Current as Product_Details).Stock = stock;
         }
         catch (Exception)
         {
             MessageBox.Show("Please Enter valid input");
             txtPPurchaseU.Focus();
         }
         (productDetailsBindingSource.Current as Product_Details).Image          = ci.ImageToByteArray(pbP.Image);
         cmd.Entry(productDetailsBindingSource.Current as Product_Details).State = EntityState.Modified;
         cmd.SaveChanges();
         //btnNew.PerformClick();
         this.Visible = false;
     }
     else
     {
         MessageBox.Show("Please Enter a Picture");
     }
 }
示例#9
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     cmd.Entry(supplierDetailsBindingSource.Current as Supplier_Details).State = EntityState.Modified;
     cmd.SaveChanges();
     //btnNew.PerformClick();
     this.Visible = false;
 }
示例#10
0
        public void AddProduct(string name, string desc, string cat, string path, int pu, int sr, int stock, int ro, int pr)
        {
            try
            {
                md.P_Name        = name;
                md.Description   = desc;
                md.P_Category    = cat;
                md.Purchase_Rate = pr;
                md.Purchase_Unit = pu;
                md.Reorder_Point = ro;
                md.Sales_Rate    = sr;
                md.Stock         = stock;
                md.Image         = ci.ConvertFileToByte(path);

                cmd.Product_Details.Add(md);
                cmd.SaveChanges();

                MessageBox.Show("Product Added succesfully");
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPass.Text.Equals(txtCPass.Text))
                {
                    int          id = int.Parse(txtId.Text);
                    User_Details u  = new User_Details();
                    u          = cmd.User_Details.First(x => x.U_ID == id);
                    u.Password = txtPass.Text;

                    cmd.Entry(u).State = EntityState.Modified;
                    cmd.SaveChanges();
                    //btnNew.PerformClick();
                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Passwords Do Not Match");
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Please fill the fields properly");
            }
        }
示例#12
0
        public void AddSupplier(string name, string address, string city, string po, string contact, string email, string remarks, string accName, string accNo, string bName, string branch)
        {
            try
            {
                md.S_Name      = name;
                md.Address     = address;
                md.City        = city;
                md.Postal_Code = po;
                md.Contact     = contact;
                md.Email_ID    = email;
                md.Remarks     = remarks;
                md.Acc_Name    = accName;
                md.Acc_No      = accNo;
                md.Bank_Name   = bName;
                md.Branch      = branch;

                cmd.Supplier_Details.Add(md);
                cmd.SaveChanges();

                MessageBox.Show("Supplier Added succesfully");
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
            }
        }
示例#13
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (productOrderBindingSource.Current == null)
     {
         return;
     }
     this.Visible = false;
     using (PurchaseOrder am = new PurchaseOrder(productOrderBindingSource.Current as Product_Order))
     {
         if (am.ShowDialog() == DialogResult.OK)
         {
             productOrderBindingSource.DataSource = cmd.Product_Order.ToList();
         }
         cmd.SaveChanges();
     }
 }
示例#14
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            productDetailsBindingSource.DataSource = cmd.Product_Details.ToList();
            var all = from a in cmd.POS select a;

            cmd.POS.RemoveRange(all);
            try
            {
                cmd.SaveChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            pOSBindingSource.DataSource = cmd.POS.ToList();
            AllButton();
        }
示例#15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ms.AddPR(int.Parse(txtPEId.Text), int.Parse(txtQuantity.Text));
            purchaseReturnBindingSource.DataSource = cmd.Purchase_Return.ToList();

            Product_Order p = new Product_Order();

            using (cmd)
            {
                p                  = cmd.Product_Order.Where(x => x.PONo.ToString().Equals(txtPONo.Text)).FirstOrDefault();
                p.Quabtity         = p.Quabtity - (int.Parse(txtQuantity.Text));
                cmd.Entry(p).State = EntityState.Modified;
                cmd.SaveChanges();
            }
            MessageBox.Show("Succesfully Return");
            txtQuantity.Clear();
            load();
        }
        public ActionResult Create([Bind(Include = "ShippingScheduleID,ShippingScheduleName,VesselID,DeparturePortID,ArrivalPortID,DepartureDateTime,ArrivalDateTime,SpaceAvailable,AdminID")] ShippingSchedule shippingSchedule)
        {
            ApplicationDbContext context = new ApplicationDbContext();

            if (ModelState.IsValid)
            {
                db.ShippingSchedules.Add(shippingSchedule);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ArrivalPortID   = new SelectList(db.Ports, "PortID", "PortName", shippingSchedule.ArrivalPortID);
            ViewBag.DeparturePortID = new SelectList(db.Ports, "PortID", "PortName", shippingSchedule.DeparturePortID);
            ViewBag.VesselID        = new SelectList(db.Vessels, "VesselID", "VesselName", shippingSchedule.VesselID);

            ViewBag.AdminID = new SelectList(db.AspNetUsers, "Id", "FullName", shippingSchedule.AdminID);
            return(View(shippingSchedule));
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (salesmanDetailsBindingSource.Current != null)
            {
                if (MessageBox.Show("Are you sure ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int id = ((Salesman_Details)salesmanDetailsBindingSource.Current).Sal_ID;
                    cmd.Salesman_Details.Remove(salesmanDetailsBindingSource.Current as Salesman_Details);
                    salesmanDetailsBindingSource.RemoveCurrent();
                    cmd.SaveChanges();

                    User_Details u = new User_Details();
                    u = cmd.User_Details.First(x => x.U_ID == id);
                    cmd.User_Details.Remove(u);
                    cmd.SaveChanges();
                }
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (managerdetailsBindingSource.Current != null)
            {
                if (MessageBox.Show("Are you sure ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int id = ((Manager_details)managerdetailsBindingSource.Current).MId;
                    cmd.Manager_details.Remove(managerdetailsBindingSource.Current as Manager_details);
                    managerdetailsBindingSource.RemoveCurrent();
                    cmd.SaveChanges();

                    //MessageBox.Show(id.ToString());

                    User_Details u = new User_Details();
                    u = cmd.User_Details.First(x => x.U_ID == id);
                    cmd.User_Details.Remove(u);
                    cmd.SaveChanges();
                }
            }
        }
        public void AddPo(string date, int id, string name, int q, float ppu, int dis)
        {
            try
            {
                po.PODate     = date;
                po.SupplierId = id;
                po.PName      = name;
                po.Quabtity   = q;
                po.PPU        = ppu;
                po.Discount   = dis;
                cmd.Product_Order.Add(po);

                cmd.SaveChanges();
                MessageBox.Show("Product Added succesfully");
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (supplierDetailsBindingSource.Current != null)
     {
         if (MessageBox.Show("Are you sure ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             cmd.Supplier_Details.Remove(supplierDetailsBindingSource.Current as Supplier_Details);
             supplierDetailsBindingSource.RemoveCurrent();
             cmd.SaveChanges();
         }
     }
 }
示例#21
0
 public ActionResult UpdateBooking([Bind(Include = "Id,BookingName,ShippingScheduleId,CargoId,AgentId,CreatedDate,Status")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewBooking"));
     }
     ViewBag.AgentId            = new SelectList(db.AspNetUsers, "Id", "Email", booking.AgentId);
     ViewBag.ShippingScheduleId = new SelectList(db.ShippingSchedules, "ShippingScheduleID", "ShippingScheduleName", booking.ShippingScheduleId);
     ViewBag.CargoId            = new SelectList(db.Cargoes, "Id", "Name", booking.CargoId);
     return(View(booking));
 }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         cmd.Entry(productOrderBindingSource.Current as Product_Order).State = EntityState.Modified;
     }
     catch (Exception ex)
     {
         cmd.SaveChanges();
     }
     btnNew.PerformClick();
     this.Visible = false;
 }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (pbS.Image != null)
     {
         (salesmanDetailsBindingSource.Current as Salesman_Details).Image          = ci.ImageToByteArray(pbS.Image);
         cmd.Entry(salesmanDetailsBindingSource.Current as Salesman_Details).State = EntityState.Modified;
         cmd.SaveChanges();
         //btnNew.PerformClick();
         this.Visible = false;
     }
     else
     {
         MessageBox.Show("Please Enter a Picture");
     }
 }
示例#24
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     if (userDetailsBindingSource.Current != null)
     {
         User_Details u = new User_Details();
         u = userDetailsBindingSource.Current as User_Details;
         if (u.User_Type != 1)
         {
             if (MessageBox.Show("Are you sure ?", "Message", MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 cmd.User_Details.Remove(userDetailsBindingSource.Current as User_Details);
                 userDetailsBindingSource.RemoveCurrent();
                 cmd.SaveChanges();
             }
         }
     }
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (purchaseEntryBindingSource.Current != null)
     {
         if (MessageBox.Show("Are you sure ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             cmd.Purchase_Entry.Remove(purchaseEntryBindingSource.Current as Purchase_Entry);
             purchaseEntryBindingSource.RemoveCurrent();
             try
             {
                 cmd.SaveChanges();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("It Has a Purchase Return Entry.\n Please remove that to remove this.");
                 purchaseEntryBindingSource.DataSource = cmd.Purchase_Entry.ToList();
             }
         }
     }
 }
示例#26
0
        public void AddSales(string inNo, string date, string proId, int q, float price, float total)
        {
            try
            {
                sd.Invoice_No = inNo;
                sd.Date       = date;
                sd.Pro_ID     = proId;
                sd.Quantity   = q;
                sd.Price      = price;
                sd.Total      = total;

                cmd.Sales_Details.Add(sd);
                cmd.SaveChanges();
                MessageBox.Show("Sales Added succesfully");
            }
            catch (Exception ex)
            {
                //MessageBox.Show("OOPs something went wrong !!!");
                MessageBox.Show(ex.Message);
            }
        }