Exemple #1
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.CostCenter costCenter = serialize.Deserialize<TMA.MODEL.Entity.CostCenter>(objProperties);

                if (costCenter.Id_CostCenter == null)
                {
                    CostCentersDao.save(costCenter);
                }
                else
                {
                    CostCentersDao.update(costCenter);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #2
0
        public string Save(string departmentProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Department department = serialize.Deserialize<TMA.MODEL.Entity.Department>(departmentProperties);

                if (department.Id_Department == null)
                {
                    DepartmentsDao.save(department);
                }
                else
                {
                    DepartmentsDao.update(department);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;
                msg.Error = ex.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #3
0
        public string Save(string UserProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                Users user = serialize.Deserialize<Users>(UserProperties);
                user.IsActive = true;
                user.Id_Role = 1;
                user.DocumentType = 1;
                user.DateCreateRegistration = System.DateTime.Now;
                user.DateModifyRegistration = System.DateTime.Now;

                if (user.Id_User == null)
                {
                    UsersDao.save(user);
                }
                else
                {
                    UsersDao.update(user);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #4
0
        public string Save(string personProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Person person = serialize.Deserialize<TMA.MODEL.Entity.Person>(personProperties);

                if (person.Id_Person == null)
                {
                    person.DateCreateRegistration = System.DateTime.Now;

                    PersonsDao.save(person);
                }
                else
                {
                    person.DateModifyRegistration = System.DateTime.Now;

                    PersonsDao.update(person);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #5
0
        public string List(int start, int limit)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                if (limit != 0)
                {
                    return JsonConvert.SerializeObject(FunctionariesDao.findAll(start, limit));
                }
                else
                {
                    return JsonConvert.SerializeObject(FunctionariesDao.findAll());
                }
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.ListErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
        public string List(int start, int limit)
        {
            MessageResponse msg = new MessageResponse();

            DataResponse<TMA.MODEL.Entity.AuditEntry> dataResponse = new DataResponse<TMA.MODEL.Entity.AuditEntry>();

            try
            {
                dataResponse.Result = AuditEntryDao.findAll(start, limit);
                dataResponse.Total = AuditEntryDao.Count();

                return dataResponse.ToJsonString();
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.ListErrorMessage;
                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            System.Threading.Thread.Sleep(int.Parse(ConfigManager.TimeForResponseRequest));

            return serialize.Serialize(msg);
        }
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();
            try
            {
                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(objProperties);

                Visit visit = new Visit();
                visit.Id_Visitor = Convert.ToDecimal(dicProperties["Id_Person"]);

                DateTime InitialDate = Convert.ToDateTime(dicProperties["InitialDate"] + " " + dicProperties["InitialHour"]);
                DateTime FinalDate = Convert.ToDateTime(dicProperties["FinalDate"] + " " + dicProperties["FinalHour"]);

                visit.InitialDate = InitialDate;
                visit.InitialHour = InitialDate;
                visit.FinalDate = FinalDate;
                visit.FinalHour = FinalDate;
                visit.Id_Functionary = (float)Convert.ToInt64(dicProperties["Id_Functionary"]);
                visit.ElementsToGetIn = dicProperties["ElementsToGetIn"];
                visit.VisitDescription = dicProperties["VisitDescription"];
                visit.DateCreateTransaction = System.DateTime.Now;
                visit.DateModifyRegistration = System.DateTime.Now;
                visit.DateCreateRegistration = System.DateTime.Now;
                VisitsDao.save(visit);

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception exception)
            {
                msg.Message = ConfigManager.SaveErrorMessage;
                msg.Error = exception.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #8
0
        public string List(string start, string limit)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                return serialize.Serialize(DepartmentsDao.findAll());
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;
                msg.Error = ex.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #9
0
        public string List(string start, string limit)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                return serialize.Serialize(UsersDao.findAll());
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;
                msg.Error = ex.ToString();
                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #10
0
        public string Save(string DiaryProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {

                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(DiaryProperties);

                Diary diary = new Diary()
                {
                    Id_Functionary = Convert.ToDecimal(dicProperties["Id_Functionary"]),
                    Id_Visitor = decimal.Parse(dicProperties["Id_Visitor"]),
                    Description = dicProperties["Description"],
                    DateDiary = Convert.ToDateTime(dicProperties["DateDiary"]).ToString(ConfigManager.FieldsTypeDateFormat),
                    HourDiary = Convert.ToDateTime(dicProperties["HourDiary"]).ToString(ConfigManager.FieldsTypeTimeFormat),
                    Id_User = 1
                };

                if (diary.Id_Diary == null)
                {
                    diary.DateCreateRegistration = System.DateTime.Now;

                    DiariesDao.save(diary);
                }
                else
                {
                    diary.DateModifyRegistration = System.DateTime.Now;

                    DiariesDao.update(diary);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #11
0
        public string Find(int start, int limit, string field, string value)
        {
            MessageResponse msg = new MessageResponse();
            DataResponse<TMA.MODEL.Entity.Person> dataResponse = new DataResponse<TMA.MODEL.Entity.Person>();

            try
            {
                dataResponse.Result = PersonsDao.findBy(start, limit, field, value);
                dataResponse.Total = PersonsDao.Count(field, value);

                return dataResponse.ToJsonString();
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.ListErrorMessage;
                msg.Error = ex.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #12
0
        public string Delete(string Id_User)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                Users user = UsersDao.find(Convert.ToInt32(Id_User));
                UsersDao.delete(user);

                msg.Message = ConfigManager.DeleteSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;
                msg.Error = ex.ToString();
                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #13
0
        public string Delete(string Id_Department)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Department department = DepartmentsDao.find(Convert.ToInt32(Id_Department));

                DepartmentsDao.delete(department);

                msg.Message = ConfigManager.DeleteSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;

                msg.Error = ex.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #14
0
        public string Delete(string Id_Company)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Company company = CompaniesDao.find(!string.IsNullOrEmpty(Id_Company) ? int.Parse(Id_Company) : -1 );

                CompaniesDao.delete(company);

                msg.Message = ConfigManager.DeleteSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #15
0
        public string Delete(string Id_Person)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Person person = PersonsDao.find(Convert.ToInt32(Id_Person));

                PersonsDao.delete(person);

                msg.Message = ConfigManager.DeleteSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #16
0
        public string Delete(int Id_Diary)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                Diary diary = DiariesDao.find(Id_Diary);

                DiariesDao.delete(diary);

                msg.Message = ConfigManager.DeleteSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.DeleteErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #17
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                HttpContext context = HttpContext.Current;

                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(objProperties);

                TMA.MODEL.Entity.Person person = PersonsDao.find(Convert.ToDecimal(util.getValueFromDictionary("Id_Person", dicProperties)));

                if (person == null)
                {
                    person = new TMA.MODEL.Entity.Person();
                    person.Id_Person = util.getValueFromDictionary("Id_Person", dicProperties) != "" ? Convert.ToInt64(util.getValueFromDictionary("Id_Person", dicProperties)) : 0;
                    person.DateCreateRegistration = System.DateTime.Now;

                    PersonsDao.save(person);
                }

                person.Name = util.getValueFromDictionary("Name", dicProperties);
                person.LastName = util.getValueFromDictionary("LastName", dicProperties);
                person.IsActive = Convert.ToInt32(util.getValueFromDictionary("IsActive", dicProperties));
                person.Address = util.getValueFromDictionary("Address", dicProperties);
                person.BirthdayDay = Convert.ToInt32(util.getValueFromDictionary("BirthdayDay", dicProperties));
                person.BirthdayMonth = Convert.ToInt32(util.getValueFromDictionary("BirthdayMonth", dicProperties));
                person.TelephoneNumber = Convert.ToInt32(util.getValueFromDictionary("TelephoneNumber", dicProperties));
                person.CelphoneNumber = Convert.ToInt64(util.getValueFromDictionary("CelphoneNumber", dicProperties));
                person.City = Convert.ToInt32(util.getValueFromDictionary("Id_City", dicProperties));
                person.Company = Convert.ToInt32(util.getValueFromDictionary("Id_Third", dicProperties));
                person.Email = util.getValueFromDictionary("Email", dicProperties);
                person.Observations = util.getValueFromDictionary("Observations", dicProperties);
                person.FaxNumber = Convert.ToInt32(util.getValueFromDictionary("FaxNumber", dicProperties));

                person.Contractor = Convert.ToInt32(util.getValueFromDictionary("Contractor", dicProperties));

                if (person.Contractor == 1)
                {
                    person.DateValidityARP = Convert.ToDateTime(util.getValueFromDictionary("DateValidityARP", dicProperties));
                }
                else
                {
                    person.DateValidityARP = null;
                }

                person.DateModifyRegistration = System.DateTime.Now;

                if (context.Request.Files[0].FileName != "")
                {
                    if (person.Photo != null && person.Photo != "")
                    {
                        if (File.Exists(Path.Combine(ConfigManager.ImagePath, person.Photo)))
                        {
                            File.Delete(Path.Combine(ConfigManager.ImagePath, person.Photo));
                        }
                    }

                    /*if (!Directory.Exists(Path.Combine(ConfigManager.ImagePath, person.Id_Person.ToString())))
                    {
                        Directory.CreateDirectory(Path.Combine(ConfigManager.ImagePath, person.Id_Person.ToString()));
                    }*/

                    //string extImage = Path.GetExtension(context.Request.Files[0].FileName);

                    context.Request.Files[0].SaveAs(Path.Combine(ConfigManager.ImagePath, util.getValueFromDictionary("Id_Person", dicProperties) /*+ extImage*/));
                    person.Photo = util.getValueFromDictionary("Id_Person", dicProperties) /*+ extImage*/;
                }

                PersonsDao.update(person);

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;
                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();
            try
            {
                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(objProperties);

                TMA.MODEL.Entity.Authorization authorization = AuthorizationsDao.find(Convert.ToInt32(dicProperties["Id_Authorization"]));

                authorization.Id_PersonEntry = dicProperties["Id_Person"];
                authorization.Id_PersonAuthorizing = Convert.ToInt32(dicProperties["Id_Functionary"]);
                authorization.StartDate = Convert.ToDateTime(dicProperties["StartDate"] + " " + dicProperties["StartHour"]);
                authorization.EndDate = Convert.ToDateTime(dicProperties["EndDate"] + " " + dicProperties["EndHour"]);
                authorization.Reason = dicProperties["Reason"];

                AuthorizationsDao.update(authorization);

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception exception)
            {
                msg.Message = ConfigManager.SaveErrorMessage;
                msg.Error = exception.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #19
0
 public ActionResponse()
 {
     data = new MessageResponse();
 }
Exemple #20
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();
            try
            {
                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(objProperties);

                TMA.MODEL.Entity.Authorization authorization = AuthorizationsDao.find(Convert.ToInt32(dicProperties["Id_Authorization"]));

                authorization.Id_PersonEntry = utility.getValueFromDictionary("Id_PersonEntry", dicProperties);
                authorization.Id_PersonAuthorizing = Convert.ToInt32(utility.getValueFromDictionary("Id_Functionary", dicProperties));

                authorization.DocumentNumberEntryPerson = utility.getValueFromDictionary("DocumentNumberEntryPerson",dicProperties);
                authorization.NameEntryPerson = utility.getValueFromDictionary("NameEntryPerson",dicProperties);
                authorization.CompanyEntryPerson = utility.getValueFromDictionary("CompanyEntryPerson", dicProperties);
                authorization.CostCenterEntryPerson = utility.getValueFromDictionary("CostCenterEntryPerson",dicProperties);
                authorization.HeadquarterEntryPerson = utility.getValueFromDictionary("HeadquarterEntryPerson", dicProperties);
                authorization.ChargeEntryPerson = utility.getValueFromDictionary("ChargeEntryPerson", dicProperties);

                authorization.StartDate = Convert.ToDateTime(utility.getValueFromDictionary("StartDate", dicProperties) + " " + utility.getValueFromDictionary("StartHour", dicProperties));
                authorization.EndDate = Convert.ToDateTime(utility.getValueFromDictionary("EndDate", dicProperties) + " " + utility.getValueFromDictionary("EndHour", dicProperties));
                authorization.Reason = utility.getValueFromDictionary("Reason", dicProperties);

                AuthorizationsDao.update(authorization);

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception exception)
            {
                msg.Message = ConfigManager.SaveErrorMessage;
                msg.Error = exception.ToString();
            }

            return serialize.Serialize(msg);
        }
Exemple #21
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                //TMA.MODEL.Entity.Functionary functionary = FunctionariesDao.find()

                TMA.MODEL.Entity.Functionary objFunctionary = serialize.Deserialize<TMA.MODEL.Entity.Functionary>(objProperties);
                TMA.MODEL.Entity.Functionary functionary;

                if (objFunctionary.Id_Functionary == null)
                {
                    functionary = new TMA.MODEL.Entity.Functionary();
                    functionary.DateCreateRegistration = System.DateTime.Now;
                    FunctionariesDao.save(functionary);
                }
                else
                {
                    functionary = FunctionariesDao.find(objFunctionary.Id_Functionary);
                }

                functionary.DateModifyRegistration = System.DateTime.Now;
                functionary.Address = objFunctionary.Address; functionary.BeeperCode = objFunctionary.BeeperCode;
                functionary.BeeperNumber = objFunctionary.BeeperNumber;
                functionary.BirthdayDay = objFunctionary.BirthdayDay;
                functionary.BirthdayMonth = objFunctionary.BirthdayMonth;
                functionary.BossExtensionNumber = objFunctionary.BossExtensionNumber;
                functionary.Email = objFunctionary.Email;
                functionary.ExtensionNumber = objFunctionary.ExtensionNumber;
                functionary.FaxNumber = objFunctionary.FaxNumber;
                functionary.LastName = objFunctionary.LastName;
                functionary.Name = objFunctionary.Name;
                functionary.Observations = objFunctionary.Observations;
                functionary.Password = objFunctionary.Password;
                functionary.AirSection = objFunctionary.AirSection;
                functionary.BossName = objFunctionary.BossName;
                functionary.ByHour = objFunctionary.ByHour;
                functionary.ByPayroll = objFunctionary.ByPayroll;
                functionary.CelphoneNumber = objFunctionary.CelphoneNumber;
                functionary.ContractClass = objFunctionary.ContractClass;
                functionary.Id_Charge = objFunctionary.Id_Charge;
                functionary.Id_City = objFunctionary.Id_City;
                functionary.Id_Company = objFunctionary.Id_Company;
                functionary.Id_CostCenter = objFunctionary.Id_CostCenter;
                functionary.Id_Dependency = objFunctionary.Id_Dependency;
                functionary.Photo = objFunctionary.Photo;
                functionary.PostalZone = objFunctionary.PostalZone;
                functionary.TelephoneNumber = objFunctionary.TelephoneNumber;
                //functionary.Turn = objFunctionary.Turn;

                functionary.FingerPrint = objFunctionary.FingerPrint;
                functionary.Id_Between = objFunctionary.Id_Between;
                functionary.Id_BiometricReader = objFunctionary.Id_BiometricReader;

                functionary.Id_Headquarter = objFunctionary.Id_Headquarter;
                functionary.IndexReader = objFunctionary.IndexReader;
                functionary.IntegralSalary = objFunctionary.IntegralSalary;
                functionary.IsActive = objFunctionary.IsActive;

                FunctionariesDao.update(functionary);

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #22
0
        public string List(int start, int limit)
        {
            MessageResponse msg = new MessageResponse();

            DataResponse<TMA.MODEL.Entity.Diary> dataResponse = new DataResponse<TMA.MODEL.Entity.Diary>();

            try
            {
                DateTime today = System.DateTime.Today;

                dataResponse.Result = DiariesDao.findBy(start, limit, "DateDiary", today.ToString("yyyy-MM-dd"));
                dataResponse.Total = DiariesDao.Count("DateDiary", today.ToString("yyyy-MM-dd"));

                return dataResponse.ToJsonString();
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.ListErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            System.Threading.Thread.Sleep(int.Parse(ConfigManager.TimeForResponseRequest));

            return serialize.Serialize(msg);
        }
Exemple #23
0
        public string Find(int start, int limit, string field, string value)
        {
            MessageResponse msg = new MessageResponse();
            DataResponse<TMA.MODEL.Entity.Diary> dataResponse = new DataResponse<TMA.MODEL.Entity.Diary>();

            try
            {
                decimal numberParam;

                if (decimal.TryParse(value, out numberParam))
                {
                    dataResponse.Result = DiariesDao.findBy(start, limit, field, numberParam);
                    dataResponse.Total = DiariesDao.Count(field, numberParam);

                    return dataResponse.ToJsonString();
                }
                else
                {
                    if (field.Contains("Person"))
                    {
                        if (field.Contains("Company"))
                        {
                            dataResponse.Result = DiariesDao.findCompanyBy(start, limit, field.Split('.')[2], value);
                            dataResponse.Total = DiariesDao.CountCompany(field.Split('.')[2], value);

                            return dataResponse.ToJsonString();
                        }
                        else
                        {
                            dataResponse.Result = DiariesDao.findPersonBy(start, limit, field.Split('.')[1], value);
                            dataResponse.Total = DiariesDao.CountPerson(field.Split('.')[1], value);

                            return dataResponse.ToJsonString();
                        }
                    }
                    if (field.Contains("Functionary"))
                    {
                        if (field.Contains("Name"))
                        {
                            dataResponse.Result = DiariesDao.findFunctionaryBy(start, limit, field.Split('.')[2], value);
                            dataResponse.Total = DiariesDao.CountFunctionary(field.Split('.')[2], value);

                            return dataResponse.ToJsonString();
                        }
                    }
                    else
                    {
                        dataResponse.Result = DiariesDao.findBy(start, limit, field, value);
                        dataResponse.Total = DiariesDao.Count(field, value);

                        return dataResponse.ToJsonString();
                    }
                }
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.ListErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #24
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                Dictionary<string, string> dicProperties = JsonConvert.DeserializeObject<Dictionary<string, string>>(objProperties);

                TMA.MODEL.Entity.Company company = CompaniesDao.find(string.IsNullOrEmpty(util.getValueFromDictionary("Id_Third", dicProperties)) ? -1 : int.Parse(util.getValueFromDictionary("Id_Third", dicProperties)));

                if (company == null)
                {

                    company = new TMA.MODEL.Entity.Company()
                    {
                        Name = util.getValueFromDictionary("Name", dicProperties),
                        Id_Subsidiary = string.IsNullOrEmpty(util.getValueFromDictionary("Id_Subsidiary", dicProperties)) ? -1 : int.Parse(util.getValueFromDictionary("Id_Subsidiary", dicProperties)),
                        AirSection = util.getValueFromDictionary("AirSection", dicProperties),
                        DateCreateRegistration = DateTime.Now

                    };

                    CompaniesDao.save(company);
                }

                else
                {
                    company.DateModifyRegistration = DateTime.Now;

                    CompaniesDao.update(company);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }
Exemple #25
0
        public string Save(string objProperties)
        {
            MessageResponse msg = new MessageResponse();

            try
            {
                TMA.MODEL.Entity.Dependency dependency = serialize.Deserialize<TMA.MODEL.Entity.Dependency>(objProperties);

                if (dependency.Id_Dependency == null)
                {
                    dependency.DateCreateRegistration = DateTime.Now;

                    DependenciesDao.save(dependency);
                }
                else
                {
                    dependency.DateModifyRegistration = DateTime.Now;

                    DependenciesDao.update(dependency);
                }

                msg.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Message = ConfigManager.SaveErrorMessage;

                msg.Error = ex.ToString();

                File.AppendAllText(ConfigManager.LogPath, msg.ToString());
            }

            return serialize.Serialize(msg);
        }