示例#1
0
        private void Authorize()
        {
            var fi = typeof(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);

            fi.SetValue(ConfigurationManager.ConnectionStrings[1], false);
            ConfigurationManager.ConnectionStrings["DBModel"].ConnectionString = @"data source = 172.24.8.84\ZALUPAKITA; initial catalog = ContractBDTest; integrated security = True; MultipleActiveResultSets = True; App = EntityFramework";

            db = new DB.DBModel();

            if (db.Users.Where(x => x.Login == tbLogin.Text && x.Password == tbPassword.Text).Count() > 0)
            {
                Properties.Settings.CurrentUserID = db.Users.First(x => x.Login == tbLogin.Text).ID;
                ParentForm main = new ParentForm(Properties.Settings.CurrentUserID);
                main.Show();
                Hide();
                if (tbServerName.Text != Program.Settings.ValueList["serverAddress"])
                {
                    Program.Settings.ChangeValue("serverAddress", tbServerName.Text);
                }
                if (tbLogin.Text != Program.Settings.ValueList["userName"])
                {
                    Program.Settings.ChangeValue("userName", tbLogin.Text);
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
示例#2
0
        public ContractForm(int contractID)
        {
            BaseEdit.DefaultErrorIconAlignment = ErrorIconAlignment.BottomRight;

            InitializeComponent();
            dbContext = new DB.DBModel();

            this.currentID = contractID;
            this.UserName  = dbContext.getFullUserName.Where(x => x.ID == Properties.Settings.CurrentUserID).ToList()[0].ToString();
            fillControls();

            currContract = new DB.Contracts();

            if (contractID != 0)
            {
                fillExistingContract(contractID);
                Text = "Договор № " + currContract.Number + " от " + String.Format("{0:dd/MM/yyyy}", currContract.Date);
            }
            else
            {
                Text            = "Новый договор";
                deDate.DateTime = DateTime.Now;
                teAuthor.Text   = dbContext.getFullUserName.Where(x => x.ID == Properties.Settings.CurrentUserID).Select(y => y.FullName).ToList()[0];
            }
        }
示例#3
0
 public SelectTreeForm(Tables table, bool isSelection, getIDFromForm sender)
 {
     InitializeComponent();
     d                = sender;
     this.Table       = table;
     this.isSelection = isSelection;
     this.dbContext   = new DB.DBModel();
 }
示例#4
0
 public SupAgreementsSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.SupAgreements;
     Text      = "Доп. соглашения";
     fillGV();
     FormClosed += SupAgreementsSelectForm_FormClosed;
 }
示例#5
0
 public DepartmentsSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Departments;
     Text      = "Департаменты";
     fillGV();
     FormClosed += DepartmentsSelectForm_FormClosed;
 }
示例#6
0
 public ContractSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Contracts;
     Text      = "Договора";
     fillGV();
     this.FormClosed += ContractSelectForm_FormClosed;
 }
示例#7
0
 public ActivityKindsSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.ActivityKinds;
     Text      = "Виды деятельности";
     fillGV();
     FormClosed += ActivityKindsSelectForm_FormClosed;
 }
示例#8
0
 public UsersSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Users;
     Text      = "Сотрудники";
     fillGV();
     FormClosed += UsersSelectForm_FormClosed;
 }
示例#9
0
 public ContractorsSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Contractors;
     Text      = "Контрагенты";
     fillGV();
     FormClosed += ContractorsSelectForm_FormClosed;
 }
示例#10
0
 public CategorySelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Category;
     Text      = "Категории договоров";
     fillGV();
     FormClosed += CategorySelectForm_FormClosed;
 }
示例#11
0
 public SigningSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Signings;
     Text      = "Согласования";
     fillGV();
     FormClosed += SigningSelectForm_FormClosed;
 }
示例#12
0
 public AnnexesSelectForm()
 {
     dbContext = new DB.DBModel();
     Table     = Tables.Contracts;
     Text      = "Приложения";
     fillGV();
     FormClosed += AnnexesSelectForm_FormClosed;
 }
示例#13
0
        public ActionResult DeleteInfo(string id, FormCollection collection)
        {
            DB.DBModel db    = new DB.DBModel();
            var        quary = (from item in db.User where item.Name == id select item);

            db.User.RemoveRange(quary);
            db.SaveChanges();
            return(RedirectToAction("Info"));
        }
示例#14
0
        public ContractAnnexForm(int annexID)
        {
            InitializeComponent();
            dbContext = new DB.DBModel();
            currAnnex = dbContext.ContractAnnex.Where(x => x.ID == annexID).ToList()[0];

            fillControls();
            fillExisting();
        }
示例#15
0
 public SupAgreementForm(int supAgreementID)
 {
     InitializeComponent();
     dbContext        = new DB.DBModel();
     currentID        = supAgreementID;
     currentAgreement = dbContext.SupAgreement.Where(x => x.ID == supAgreementID).ToList()[0];
     fillControls();
     fillExisting();
 }
示例#16
0
        public ActionResult ChangeCompany(FormCollection collection)
        {
            int ID = int.Parse(collection["ID"]);

            DB.DBModel db = new DB.DBModel();
            DB.Company c  = (from item in db.Company where item.ID == ID select item).FirstOrDefault();
            c.Name = collection["Name"];
            db.SaveChanges();
            return(RedirectToAction("Company"));
        }
示例#17
0
        public CategorySelectForm(getIDFromForm sender)
        {
            dbContext = new DB.DBModel();
            Table     = Tables.Category;
            Text      = "Категории договоров";

            this.d           = sender;
            this.isSelection = true;
            fillGV();
        }
示例#18
0
 public ContractorsSelectForm(getIDFromForm sender)
 {
     dbContext   = new DB.DBModel();
     Table       = Tables.Contractors;
     Text        = "Контрагенты";
     d           = sender;
     isSelection = true;
     fillGV();
     FormClosed += ContractorsSelectForm_FormClosed;
 }
示例#19
0
 public ActivityKindsSelectForm(getIDFromForm sender)
 {
     dbContext   = new DB.DBModel();
     Table       = Tables.ActivityKinds;
     Text        = "Виды деятельности";
     d           = sender;
     isSelection = true;
     fillGV();
     FormClosed += ActivityKindsSelectForm_FormClosed;
 }
示例#20
0
 public DepartmentsSelectForm(getIDFromForm sender)
 {
     dbContext   = new DB.DBModel();
     Table       = Tables.Departments;
     Text        = "Департаменты";
     d           = sender;
     isSelection = true;
     fillGV();
     FormClosed += DepartmentsSelectForm_FormClosed;
 }
示例#21
0
 public UsersSelectForm(getIDFromForm sender)
 {
     dbContext   = new DB.DBModel();
     Table       = Tables.Users;
     Text        = "Сотрудники";
     d           = sender;
     isSelection = true;
     fillGV();
     FormClosed += UsersSelectForm_FormClosed;
 }
示例#22
0
        public ActionResult DeleteCompany(string id, FormCollection collection)
        {
            int ID = int.Parse(id);

            DB.DBModel db    = new  DB.DBModel();
            var        query = from item in db.Company where item.ID == ID select item;

            db.Company.RemoveRange(query);
            db.SaveChanges();
            return(RedirectToAction("Company"));
        }
示例#23
0
 public ActionResult ChangeInfo(string id)
 {
     if (string.IsNullOrEmpty(id))
     {
         // Молча вернуться в список
         return(RedirectToAction("Info"));
     }
     DB.DBModel db = new DB.DBModel();
     DB.User    c  = (from item in db.User where item.Name == id select item).FirstOrDefault();
     return(View(c));
 }
示例#24
0
 public ActionResult CreateCompany(FormCollection collection)
 {
     DB.DBModel db = new DB.DBModel();
     DB.Company c  = new DB.Company()
     {
         Name = collection["Name"]
     };
     db.Company.Add(c);
     db.SaveChanges();
     return(RedirectToAction("CreateCompany"));
 }
 public TimeTableEditViewModel(byte dayOfWeek, int id = 0)
 {
     if (id == 0)
     {
         Entity           = new DB.TimeTable();
         Entity.DayOfWeek = dayOfWeek;
     }
     using (var context = new DB.DBModel())
     {
         Entity = context.TimeTable.Where(x => x.LessonNumber == id && x.DayOfWeek == dayOfWeek).FirstOrDefault();
     }
 }
示例#26
0
        public ActionResult ChangeCompany(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                // Молча вернуться в список
                return(RedirectToAction("Company"));
            }
            int ID = int.Parse(id);

            DB.DBModel db = new DB.DBModel();
            DB.Company c  = (from item in db.Company where item.ID == ID select item).FirstOrDefault();
            return(View(c));
        }
示例#27
0
        public ActionResult ChangeInfo(FormCollection collection)
        {
            string ID = collection["Name"];

            DB.DBModel db = new DB.DBModel();
            DB.User    c  = (from item in db.User where item.Name == ID select item).FirstOrDefault();
            c.Name           = collection["Name"];
            c.Login          = collection["Login"];
            c.Password       = collection["Password"];
            c.IDCompany      = int.Parse(collection["IDCompany"]);
            c.StatusContract = collection["StatusContract"];
            db.SaveChanges();
            return(RedirectToAction("Info"));
        }
示例#28
0
 public ActionResult CreateUser(FormCollection collection)
 {
     DB.DBModel db = new DB.DBModel();
     DB.User    c  = new DB.User()
     {
         Name           = collection["Name"],
         Login          = collection["Login"],
         Password       = collection["Password"],
         IDCompany      = int.Parse(collection["IDCompany"]),
         StatusContract = collection["StatusContract"],
     };
     db.User.Add(c);
     db.SaveChanges();
     return(RedirectToAction("CreateUser"));
 }
示例#29
0
        public SigningForm(int signID)
        {
            InitializeComponent();

            dbContext      = new DB.DBModel();
            this.currentID = signID;
            //this.contractID = contractID;

            currContract = dbContext.Signing.Where(x => x.ID == signID).ToList()[0].Contracts;
            fillDocInfo();
            fillGVSign();
            if ((bool)dbContext.Signing.Where(x => x.ID == signID).ToList()[0].IsAgreed)
            {
                sbAgree.Visible = false;
            }
        }
示例#30
0
        public ActionResult Company()
        {
            DB.DBModel            db   = new DB.DBModel();
            List <Models.Company> list = new List <Models.Company>();
            var query = from i1 in db.Company
                        orderby i1.Name
                        select i1;

            foreach (var a in query)
            {
                Models.Company item = new Models.Company()
                {
                    ID   = a.ID,
                    Name = a.Name
                };
                list.Add(item);
            }

            return(View("Company", list));
        }