public void updateClient(clients clnt)
        {
            OfficeDeskDB db     = new OfficeDeskDB();
            var          client = from clients in db.clientss
                                  where clients.ID == clnt.ID
                                  select clients;

            if (client.Count() > 0)
            {
                foreach (clients c in client)
                {
                    c.name             = clnt.name;
                    c.pan_no           = clnt.pan_no;
                    c.email            = clnt.email;
                    c.contact_no       = clnt.contact_no;
                    c.address          = clnt.address;
                    c.bank_accountNo   = clnt.bank_accountNo;
                    c.accountType      = clnt.accountType;
                    c.aadhar_no        = clnt.aadhar_no;
                    c.aadharLinkStatus = clnt.aadharLinkStatus;
                    c.group_id         = clnt.group_id;
                    c.gstin            = clnt.gstin;
                }
                db.SaveChanges();
                db.Dispose();
            }
            else
            {
                var client_new = new clients();
                client_new.name             = clnt.name;
                client_new.pan_no           = clnt.pan_no;
                client_new.email            = clnt.email;
                client_new.contact_no       = clnt.contact_no;
                client_new.address          = clnt.address;
                client_new.bank_accountNo   = clnt.bank_accountNo;
                client_new.accountType      = clnt.accountType;
                client_new.aadhar_no        = clnt.aadhar_no;
                client_new.aadharLinkStatus = clnt.aadharLinkStatus;
                client_new.group_id         = clnt.group_id;
                client_new.gstin            = clnt.gstin;

                db.clientss.Add(client_new);
                db.SaveChanges();
                db.Dispose();
            }
        }
Exemple #2
0
        /// <summary>
        /// method to update existing as well as new tasks.
        /// </summary>
        /// <param name="empID">employee id of user</param>
        public void updateTasks(currenttasks task)
        {
            OfficeDeskDB db = new OfficeDeskDB();
            var          CD = db;
            var          CT = from currenttaskss in db.currenttaskss
                              where currenttaskss.ID == task.ID
                              select currenttaskss;

            if (CT.Count() != 0)
            {
                foreach (currenttasks ct in CT)
                {
                    ct.DateOfAssignment = Convert.ToDateTime(task.DateOfAssignment);
                    ct.SubjectWithParty = task.SubjectWithParty;
                    ct.assignee         = task.assignee;
                    ct.priority         = task.priority;
                    ct.TaskDescription  = task.TaskDescription;
                    ct.DocumentsSource  = task.TaskDescription;
                    ct.assigner         = task.assigner;
                    ct.status           = task.status;
                    ct.remarks          = task.remarks;
                    ct.ClientID         = task.ClientID;
                    db.SaveChanges();
                    db.Dispose();
                }
            }
            else
            {
                currenttasks ct = new currenttasks();
                ct.DateOfAssignment = Convert.ToDateTime(task.DateOfAssignment);
                ct.ClientID         = task.ClientID;
                ct.SubjectWithParty = task.SubjectWithParty;
                ct.empId            = task.empId;
                ct.areaOfWork       = task.areaOfWork;
                ct.priority         = task.priority;
                ct.TaskDescription  = task.TaskDescription;
                ct.DocumentsSource  = task.DocumentsSource;
                ct.assignee         = task.assignee;
                ct.assigner         = task.assigner;
                ct.status           = task.status;
                ct.remarks          = task.remarks;
                db.currenttaskss.Add(ct);
                db.SaveChanges();
                db.Dispose();
            }
        }