private void updateClientEmployment(ClientEmployment clientEmployment) { Logger.LogInfo("UPDATE: Client Employment process start."); string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, clientEmployment.Cid)); string value = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_EMPLOYMENT_RECORD, clientEmployment.Cid)); bool isRecordExist = (value.Equals("0")) ? false : true; if (isRecordExist) { DataBase.DBService.ExecuteCommand(string.Format(UPDATE_CLIENT_EMPLOYMENT_QUERY, clientEmployment.Designation, clientEmployment.EmployerName, clientEmployment.Address, clientEmployment.Street, clientEmployment.City, clientEmployment.Pin, clientEmployment.Income, clientEmployment.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), clientEmployment.UpdatedBy, clientEmployment.Cid)); Activity.ActivitiesService.Add(ActivityType.UpdateEmployment, EntryStatus.Success, Source.Server, clientEmployment.UpdatedByUserName, clientName, clientEmployment.MachineName); } else { DataBase.DBService.ExecuteCommand(string.Format(INSERT_CLIENT_EMPLOYMENT_QUERY, clientEmployment.Cid, clientEmployment.Designation, clientEmployment.EmployerName, clientEmployment.Address, clientEmployment.Street, clientEmployment.City, clientEmployment.Pin, clientEmployment.Income, clientEmployment.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), clientEmployment.CreatedBy, clientEmployment.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), clientEmployment.UpdatedBy)); Activity.ActivitiesService.Add(ActivityType.UpdateEmployment, EntryStatus.Success, Source.Server, clientEmployment.UpdatedByUserName, clientName, clientEmployment.MachineName); } Logger.LogInfo("UPDATE: Client Employment process completed."); }
private ClientEmployment convertToClientEmploymentObject(DataRow dr) { ClientEmployment clientEmployment = new ClientEmployment(); clientEmployment.Id = dr.Field <int>("ID"); clientEmployment.Cid = dr.Field <int>("CID"); clientEmployment.Designation = dr.Field <string>("Designation"); clientEmployment.EmployerName = dr.Field <string>("EmployerName"); clientEmployment.Address = dr.Field <string>("Address"); clientEmployment.Street = dr.Field <string>("Street"); clientEmployment.City = dr.Field <string>("City"); clientEmployment.Pin = dr.Field <string>("pin"); clientEmployment.Income = dr.Field <string>("Income"); return(clientEmployment); }