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; } }
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]; } }
public SelectTreeForm(Tables table, bool isSelection, getIDFromForm sender) { InitializeComponent(); d = sender; this.Table = table; this.isSelection = isSelection; this.dbContext = new DB.DBModel(); }
public SupAgreementsSelectForm() { dbContext = new DB.DBModel(); Table = Tables.SupAgreements; Text = "Доп. соглашения"; fillGV(); FormClosed += SupAgreementsSelectForm_FormClosed; }
public DepartmentsSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Departments; Text = "Департаменты"; fillGV(); FormClosed += DepartmentsSelectForm_FormClosed; }
public ContractSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Contracts; Text = "Договора"; fillGV(); this.FormClosed += ContractSelectForm_FormClosed; }
public ActivityKindsSelectForm() { dbContext = new DB.DBModel(); Table = Tables.ActivityKinds; Text = "Виды деятельности"; fillGV(); FormClosed += ActivityKindsSelectForm_FormClosed; }
public UsersSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Users; Text = "Сотрудники"; fillGV(); FormClosed += UsersSelectForm_FormClosed; }
public ContractorsSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Contractors; Text = "Контрагенты"; fillGV(); FormClosed += ContractorsSelectForm_FormClosed; }
public CategorySelectForm() { dbContext = new DB.DBModel(); Table = Tables.Category; Text = "Категории договоров"; fillGV(); FormClosed += CategorySelectForm_FormClosed; }
public SigningSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Signings; Text = "Согласования"; fillGV(); FormClosed += SigningSelectForm_FormClosed; }
public AnnexesSelectForm() { dbContext = new DB.DBModel(); Table = Tables.Contracts; Text = "Приложения"; fillGV(); FormClosed += AnnexesSelectForm_FormClosed; }
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")); }
public ContractAnnexForm(int annexID) { InitializeComponent(); dbContext = new DB.DBModel(); currAnnex = dbContext.ContractAnnex.Where(x => x.ID == annexID).ToList()[0]; fillControls(); fillExisting(); }
public SupAgreementForm(int supAgreementID) { InitializeComponent(); dbContext = new DB.DBModel(); currentID = supAgreementID; currentAgreement = dbContext.SupAgreement.Where(x => x.ID == supAgreementID).ToList()[0]; fillControls(); fillExisting(); }
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")); }
public CategorySelectForm(getIDFromForm sender) { dbContext = new DB.DBModel(); Table = Tables.Category; Text = "Категории договоров"; this.d = sender; this.isSelection = true; fillGV(); }
public ContractorsSelectForm(getIDFromForm sender) { dbContext = new DB.DBModel(); Table = Tables.Contractors; Text = "Контрагенты"; d = sender; isSelection = true; fillGV(); FormClosed += ContractorsSelectForm_FormClosed; }
public ActivityKindsSelectForm(getIDFromForm sender) { dbContext = new DB.DBModel(); Table = Tables.ActivityKinds; Text = "Виды деятельности"; d = sender; isSelection = true; fillGV(); FormClosed += ActivityKindsSelectForm_FormClosed; }
public DepartmentsSelectForm(getIDFromForm sender) { dbContext = new DB.DBModel(); Table = Tables.Departments; Text = "Департаменты"; d = sender; isSelection = true; fillGV(); FormClosed += DepartmentsSelectForm_FormClosed; }
public UsersSelectForm(getIDFromForm sender) { dbContext = new DB.DBModel(); Table = Tables.Users; Text = "Сотрудники"; d = sender; isSelection = true; fillGV(); FormClosed += UsersSelectForm_FormClosed; }
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")); }
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)); }
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(); } }
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)); }
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")); }
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")); }
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; } }
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)); }