示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public DepotView()
        {
            InitializeComponent();
            depotModel = new DepotModel();
            bankModel  = new BankAccountModel();

            refreshDepotDataAsync();
            updateStockPricesInListViewAsync();

            cbxDataProvider.Items.Add(FinanceAPI.FinanceStrategies.Google);
            cbxDataProvider.Items.Add(FinanceAPI.FinanceStrategies.Yahoo);
            cbxDataProvider.SelectedItem = webFinanceStrategy;

            lvwColumnSorter            = new ListViewColumnSorter();
            lvDepot.ListViewItemSorter = lvwColumnSorter;

            lvDepot.Columns.Add("Buchwert");
            lvDepot.Columns.Add("Marktkapitalisierung");
            lvDepot.Columns.Add("50 Tage");
            lvDepot.Columns.Add("250 Tage");

            setDefaultCurrencyInLabel();
            mainForm.setHeadline("Depot");
            toggleToolbar(true);

            dpEnddate.Value     = endDate;
            dpStartdate.MaxDate = DateTime.Now;
            dpStartdate.Value   = startDate;

            dpEnddate.ValueChanged   += new EventHandler(datetime_Changed);
            dpStartdate.ValueChanged += new EventHandler(datetime_Changed);
        }
示例#2
0
        private List <DepotModel> ActvityDataReader_MaptoList(SqlDataReader reader)
        {
            List <DepotModel> lstDepotModel = new List <DepotModel>();

            while (reader.Read())
            {
                DepotModel DepModel = new DepotModel();

                DepModel.Company_Code         = reader["Company_Code"].ToString();
                DepModel.Depot_Code           = reader["Depot_Code"].ToString();
                DepModel.Location             = reader["Location"].ToString();
                DepModel.Depot_Name           = reader["Depot_Name"].ToString();
                DepModel.Depot_Short_Name     = reader["Depot_Short_Name"].ToString();
                DepModel.Address1             = reader["Address1"].ToString();
                DepModel.Address2             = reader["Address2"].ToString();
                DepModel.Phone_Number         = reader["Phone_Number"].ToString();
                DepModel.Mobile_Number        = reader["Mobile_Number"].ToString();
                DepModel.Drug_License_Number1 = reader["Drug_License_Number1"].ToString();
                DepModel.Drug_License_Number2 = reader["Drug_License_Number2"].ToString();
                DepModel.CST_Number           = reader["CST_Number"].ToString();
                DepModel.Ref_Key1             = reader["Ref_Key1"].ToString();

                lstDepotModel.Add(DepModel);
            }
            return(lstDepotModel);
        }
        public int InsertDepotDetails(string DepotCode, string DepName, string DepShtName, string Add1, string Add2, string phne, string mob, string DLN1, string DLN2, string GST, string RKey1)
        {
            List <DepotModel> lstDepModel = new List <DepotModel>();
            DepotModel        DM          = new DepotModel();
            string            CmpCode     = _objCurrentInfo.GetCompanyCode();
            string            UsrCode     = _objCurrentInfo.GetUserCode();

            DM.Company_Code         = CmpCode;
            DM.Depot_Code           = DepotCode;
            DM.Location             = "";
            DM.Depot_Name           = DepName;
            DM.Depot_Short_Name     = DepShtName;
            DM.Address1             = Add1;
            DM.Address2             = Add2;
            DM.Phone_Number         = phne;
            DM.Mobile_Number        = mob;
            DM.Drug_License_Number1 = DLN1;
            DM.Drug_License_Number2 = DLN2;
            DM.CST_Number           = GST;
            DM.UserCode             = UsrCode;
            DM.Ref_Key1             = RKey1;

            lstDepModel.Add(DM);

            return(_objDALDepotMaster.InsertDepot(lstDepModel));
        }
示例#4
0
        public List <DepotModel> GetDepotDetails()
        {
            SqlConnection objSqlConnection = new SqlConnection();
            DepotModel    lstDeptModel     = new DepotModel();

            try
            {
                //Set command objects
                SqlCommand command = new SqlCommand(SP_HD_GETDEPOTMASTER);
                command.CommandType = CommandType.StoredProcedure;

                //Opens Connection
                _objData.OpenConnection();

                // Execuete the command.
                using (SqlDataReader reader = _objData.ExecuteReader(command))
                {
                    // converts and retruns the "Depot Master" list.
                    return(ActvityDataReader_MaptoList(reader));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
示例#5
0
 public ActionResult addDepot(DepotModel depotModel)
 {
     using (DepotManager dm = new DepotManager())
     {
         dm.SaveDepot(depotModel);
     }
     return(RedirectToAction("Index"));
 }
示例#6
0
        public string SaveDepot(DepotModel model)
        {
            var depotEntity = model.DepotEntity();

            dc.tDepots.InsertOnSubmit(depotEntity);
            dc.SubmitChanges();
            return("İşlem Başarılı");
        }
示例#7
0
        public string UpdateDepot(DepotModel model)
        {
            var depotEntity = dc.tDepots.Where(a => a.Id == model.Id).FirstOrDefault();

            depotEntity.Code = model.Code;
            depotEntity.Name = model.Name;
            dc.SubmitChanges();
            return("İşlem Başarılı");
        }
示例#8
0
 public static tDepot DepotEntity(this DepotModel item)
 {
     return(new tDepot
     {
         Id = item.Id,
         Code = item.Code,
         Name = item.Name
     });
 }
        public IActionResult Edit(DepotModel obj)
        {
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (ModelState.IsValid)
            {
                DepotModel before     = DepotRepository.FindByID((int)obj.Id);
                int        difference = obj.totalcount - before.totalcount;

                obj.notusecount = before.notusecount + difference;

                obj.inusecount = before.inusecount;
                DepotRepository.Update(obj);
                return(RedirectToAction("Index"));
            }
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in assets)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;
            return(View(obj));
        }
        // GET: /Depot/Edit/1
        public IActionResult Edit(int?id)
        {
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in assets)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands         = tempBrands;
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (id == null)
            {
                return(NotFound());
            }
            DepotModel obj = DepotRepository.FindByID(id.Value);

            if (obj == null)
            {
                return(NotFound());
            }
            return(View(obj));
        }
 public IActionResult Create(DepotModel cust)
 {
     ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
     ViewData["department"] = HttpContext.Session.GetString("department");
     if (ModelState.IsValid)
     {
         DepotRepository.Add(cust);
         return(RedirectToAction("Index"));
     }
     return(View(cust));
 }
示例#12
0
        public static int DeleteDepotMed(int id)
        {
            DepotModel data = new DepotModel
            {
                MedicationId = id
            };

            string sql = @"delete from dbo.Depot
                        where MedicationId = @MedicationId;";

            return(SqlDataAccess.SaveData(sql, data));
        }
示例#13
0
        public ActionResult EditDepotMedication(int param1, int param2)
        {
            ViewBag.Message = "Edit Depot Medication Page";

            var depotMed = new DepotModel
            {
                MedicationId = param1,
                Quantity     = param2
            };

            return(View(depotMed));
        }
示例#14
0
        public static int AddToDepot(int medicationId, int quantity)
        {
            DepotModel data = new DepotModel
            {
                MedicationId = medicationId,
                Quantity     = quantity
            };

            string sql = @"insert into dbo.Depot (MedicationId, Quantity)
                        values (@MedicationId, @Quantity);";

            return(SqlDataAccess.SaveData(sql, data));
        }
        public Boolean deleteDepo(Boolean before, AssetModel obj)
        {
            if (before == false)
            {
                DepotRepository DepotRepository = new DepotRepository(configuration);
                DepotModel      depoObj         = DepotRepository.FindByID(obj.depot_id);

                depoObj.inusecount  -= obj.numberofasset;
                depoObj.notusecount += obj.numberofasset;
                DepotRepository.Update(depoObj);
                return(true);
            }
            return(true);
        }
示例#16
0
        public static int EditMedQuantity(int id, int quantity)
        {
            DepotModel data = new DepotModel
            {
                MedicationId = id,
                Quantity     = quantity
            };

            string sql = @"update dbo.Depot 
                        set Quantity = @Quantity 
                        where MedicationId = @MedicationId;";

            return(SqlDataAccess.SaveData(sql, data));
        }
示例#17
0
        public static List <DepotModel> LoadDepotMedication(int id)
        {
            DepotModel data = new DepotModel
            {
                MedicationId = id,
                Quantity     = 0
            };

            string sql = @"select MedicationId, Quantity 
                        from dbo.Depot
                        where MedicationId = @MedicationId;";

            return(SqlDataAccess.LoadSpecificData <DepotModel>(sql, data));
        }
示例#18
0
        // Deletes a depot
        public ActionResult Delete()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // Checks if logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                int depotID = int.Parse(RouteData.Values[""].ToString());

                // Establishes models
                DepotModel    depotModel    = new DepotModel();
                EmployeeModel employeeModel = new EmployeeModel();

                // Gets list of all employees
                var employeeList = employeeModel.GetEmployeesList();

                // For each employee in depot
                foreach (var employee in employeeList)
                {
                    // If employee belongs to depot
                    if (employee.Depot == depotID)
                    {
                        // Sets the depot to null
                        employee.Depot = 0;

                        // Saves employee to database
                        employeeModel.EditEmployee(employee);
                    }
                }

                // Deletes the depot from the database using the ID
                depotModel.DeleteDepot(depotID);

                return(Redirect("/..depot"));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }
示例#19
0
 private void DepotAddAndEdit_Load(object sender, EventArgs e)
 {
     num = DepotList.num;
     if (num == 0)
     {
         dm = DepotList.dm;
         this.textBox1.Text   = dm.Ckm;
         this.textBox2.Text   = dm.Phone;
         this.Text            = "修改";
         this.button1.Visible = false;
     }
     else
     {
         this.Text            = "添加";
         this.button3.Visible = false;
     }
 }
示例#20
0
        // GET: Depot/Details/5
        public ActionResult Details(string code)
        {
            Depot x = dao.rechercher(code);

            DepotModel pm = new DepotModel
            {
                codeDEPOT    = x.codeDEPOT,
                nom          = x.nom,
                adresse      = x.adresse,
                email        = x.email,
                pays         = x.pays,
                telephone    = x.telephone,
                ville        = x.ville,
                localisation = x.localisation
            };

            if (x == null)
            {
                return(HttpNotFound());
            }
            return(View(pm));
        }
示例#21
0
        // Controller for modification of a depot
        public ActionResult EditDepot()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // Checks if logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Creates a role placeholder
                var depot = new Depot();

                // Setup role edit
                depot.ID          = int.Parse(Request.Form["id"]);
                depot.ManagerID   = int.Parse(Request.Form["managerID"]);
                depot.DepotName   = Request.Form["depotName"];
                depot.FloorSpace  = int.Parse(Request.Form["floorSpace"]);
                depot.NumVehicles = int.Parse(Request.Form["numVehicles"]);

                // Establishes role model
                var depotModel = new DepotModel();

                // Conduct edit
                depotModel.EditDepot(depot);

                // Passes back to the view
                return(View());
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }
示例#22
0
        // GET: Depot
        public ActionResult Index()
        {
            // Ensures logged in
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // Checks if logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Establishes depot model
                DepotModel depotModel = new DepotModel();

                // Holds the new depot
                Depot newDepot = new Depot();

                // Stored details for the depot
                newDepot.AddressID   = int.Parse(Request.Form[0]);
                newDepot.ManagerID   = int.Parse(Request.Form[1]);
                newDepot.DepotName   = Request.Form[2];
                newDepot.FloorSpace  = Double.Parse(Request.Form[3]);
                newDepot.NumVehicles = int.Parse(Request.Form[4]);

                // Adds the object to the database
                depotModel.CreateDepot(newDepot);

                // Return created department to view
                return(View(newDepot));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }
示例#23
0
        // GET: Depot/Edit/5
        public ActionResult Edit(string code)
        {
            Depot x = dao.rechercher(code);

            DepotModel pm = new DepotModel
            {
                nom          = x.nom,
                ville        = x.ville,
                pays         = x.pays,
                telephone    = x.telephone,
                email        = x.email,
                adresse      = x.adresse,
                localisation = x.localisation,


                ///*******
                ///
                codeU     = x.codeU,
                codeDEPOT = x.codeDEPOT
            };

            return(View(pm));
        }
示例#24
0
        /// <summary>
        /// Constructor
        /// </summary>
        public BankAccountView()
        {
            InitializeComponent();
            bankModel  = new BankAccountModel();
            depotModel = new DepotModel();

            cbxTransactionType.DisplayMember = "Description";
            cbxTransactionType.Items.Add(new TransactionItem {
                Description = "Einzahlen", TransactionType = 'c'
            });
            cbxTransactionType.Items.Add(new TransactionItem {
                Description = "Auszahlen", TransactionType = 't'
            });
            cbxTransactionType.SelectedIndex = 0;

            splitContainerMain.Panel2Collapsed = true;

            startDate.MaxDate = DateTime.Now;
            startDate.Value   = DateTime.Now.AddDays(-7);

            setDefaultCurrencyInLabel();
            mainForm.setHeadline("Bank");
        }
 public Boolean updateDepo(Boolean before, AssetModel obj, AssetModel objBefore)
 {
     if (before == false)
     {
         int differenceUse = obj.numberofasset - objBefore.numberofasset;
         if (differenceUse != 0)
         {
             DepotRepository DepotRepository = new DepotRepository(configuration);
             DepotModel      depoObj         = DepotRepository.FindByID(obj.depot_id);
             if (depoObj.notusecount > differenceUse)
             {
                 depoObj.inusecount  += differenceUse;
                 depoObj.notusecount -= differenceUse;
                 DepotRepository.Update(depoObj);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     return(true);
 }
示例#26
0
 public ActionResult AddMedicationToDepot(DepotModel model)
 {
     if (ModelState.IsValid)
     {
         var data = LoadDepot();
         List <DepotModel> depot = new List <DepotModel>();
         foreach (var row in data)
         {
             depot.Add(new DepotModel
             {
                 MedicationId = row.MedicationId,
                 Quantity     = row.Quantity
             });
         }
         bool exists = false;
         foreach (var medication in depot)
         {
             if (medication.MedicationId == model.MedicationId)
             {
                 AddMedicationQuantity(model.MedicationId, model.Quantity);
                 exists = true;
                 break;
             }
         }
         if (exists == false)
         {
             int recordsCreated = AddToDepot(model.MedicationId, model.Quantity);
             return(RedirectToAction("ViewDepot"));
         }
         return(RedirectToAction("ViewDepot"));
     }
     else
     {
         return(View());
     }
 }
示例#27
0
 public ActionResult EditDepotMedication(DepotModel model)
 {
     EditMedQuantity(model.MedicationId, model.Quantity);
     return(RedirectToAction("ViewDepot"));
 }
示例#28
0
        // GET: Depot/Create
        public ActionResult Create(Depot m)
        {
            DepotModel pm = new DepotModel();

            return(View("Create", pm));
        }
示例#29
0
        // Returns a complete list of employees
        public ActionResult Employees()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // If logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Creates models
                var employeeModel   = new EmployeeModel();
                var departmentModel = new DepartmentModel();
                var roleModel       = new RoleModel();
                var depotModel      = new DepotModel();

                // Gets the complete list
                List <Employee> el = employeeModel.GetEmployeesList();

                if (el.Count != 0)
                {
                    // Attaches associated department / role to employee
                    foreach (var employee in el)
                    {
                        // Acquires, and adds the employee depot
                        Depot depot = null;
                        if (employee.Depot != 0)
                        {
                            depot = depotModel.SearchDepot(employee.Depot);
                        }

                        // Acquires, and adds the employee department
                        Department dept = null;
                        if (employee.Dept != 0)
                        {
                            dept = departmentModel.SearchDepartment(employee.Dept);
                        }

                        // Acquires, and adds the employee role
                        Role role = null;
                        if (employee.Role != 0)
                        {
                            role = roleModel.SearchRoles(employee.Role);
                        }

                        // Appends objects to employee
                        employee.DepotO     = depot;
                        employee.Department = dept;
                        employee.RoleO      = role;
                    }

                    // Returns the list
                    return(View(el));
                }
                else
                {
                    return(Redirect("/403.html"));
                }
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }