public static void EditDepartment(string deptcode, string deptname, string contactname,
                                   string phone, string fax, string headname, string collectionpoint, string repname,
                                   string contacttitle, string headtitle)
 {
     using (Model1 entities = new Model1())
     {
         Department department = entities.Departments.Where(p => p.DeptCode == deptcode).First <Department>();
         department.DeptName        = deptname;
         department.ContactName     = contactname;
         department.Phone           = phone;
         department.Fax             = fax;
         department.HeadName        = headname;
         department.CollectionPoint = collectionpoint;
         department.RepName         = repname;
         department.HeadTitle       = headtitle;
         department.ContactTitle    = contacttitle;
         entities.SaveChanges();
     }
 }
Beispiel #2
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            Model1 ctx   = new Model1();
            int    count = ctx.Users.Count();

            User[] users = new User[count];
            users = ctx.Users.ToArray();
            User       u           = ctx.Users.Where(x => x.Email == tbx_Email.Text).First();
            encryption enc         = new encryption();
            string     newpassword = enc.Encryption(tbx_Password.Text.ToString());

            u.Password = newpassword;
            ctx.SaveChanges();
            lbl_Status.Text          = "Reset Successful!";
            tbx_Password.Enabled     = false;
            tbx_Confirm.Enabled      = false;
            tbx_Email.Enabled        = true;
            tbx_UserName.Enabled     = true;
            tbx_Verification.Enabled = true;
        }
 public static void AddNewSupplier(string suppcode, string suppname, string contacttitle, string contactname,
                                   string phone, string fax, string address, string postcode, string gst)
 {
     using (Model1 entities = new Model1())
     {
         Supplier supplier = new Supplier()
         {
             SuppCode     = suppcode,
             SuppName     = suppname,
             ContactTitle = contacttitle,
             ContactName  = contactname,
             Phone        = phone,
             Fax          = fax,
             Address      = address,
             PostalCode   = postcode,
             GSTNo        = gst,
         };
         entities.Suppliers.Add(supplier);
         entities.SaveChanges();
     }
 }
 public static void AddRequest(int RequestID, string DeptCode, string DeptName, int UserID, string UserName, DateTime Date, string ApprovalStatus, int ApprovalBy, string ABName, string Comment, string CollectionStatus, string CollectionPoint)
 {
     using (Model1 entities = new Model1())
     {
         Request request = new Request
         {
             RequestID        = RequestID,
             DeptCode         = DeptCode,
             DeptName         = DeptName,
             UserID           = UserID,
             UserName         = UserName,
             Date             = Date,
             ApprovalStatus   = ApprovalStatus,
             ApprovalBy       = ApprovalBy,
             ABName           = ABName,
             Comment          = Comment,
             CollectionPoint  = CollectionPoint,
             CollectionStatus = CollectionStatus,
         };
         entities.Requests.Add(request);
         entities.SaveChanges();
     }
 }
 //
 public static void AddNewDepartment(string deptcode, string deptname, string contactname,
                                     string phone, string fax, string headname, string collectionpoint, string repname,
                                     string contacttitle, string headtitle)
 {
     using (Model1 entities = new Model1())
     {
         Department department = new Department()
         {
             DeptCode        = deptcode,
             DeptName        = deptname,
             ContactName     = contactname,
             Phone           = phone,
             Fax             = fax,
             HeadName        = headname,
             CollectionPoint = collectionpoint,
             RepName         = repname,
             ContactTitle    = contacttitle,
             HeadTitle       = headtitle,
         };
         entities.Departments.Add(department);
         entities.SaveChanges();
     }
 }