Exemplo n.º 1
0
 public IActionResult CreateOrEditCallReason(CreateOrEditCallReasonDto input)
 {
     if (input.ID == Guid.Empty.ToString() || string.IsNullOrEmpty(input.ID))
     {
         return(Ok(_callCategoryRepository.CreateCallReason(input, User.FindFirst(ClaimTypes.NameIdentifier).Value)));
     }
     else
     {
         return(Ok(_callCategoryRepository.UpdateCallReason(input, User.FindFirst(ClaimTypes.NameIdentifier).Value)));
     }
 }
Exemplo n.º 2
0
        public object UpdateCallReason(CreateOrEditCallReasonDto input, string UserId)
        {
            try
            {
                DynamicParameters param = new DynamicParameters();
                String            sql   = "UPDATE CALL_REASON SET " +
                                          "MODIFIED_USER_ID=@MODIFIED_USER_ID, " +
                                          "DATE_MODIFIED=@DATE_MODIFIED," +
                                          "NAME=@NAME," +
                                          "CALL_RESULT_ID=@CALL_RESULT_ID," +
                                          "DO_NOT_CALL_LIST=@DO_NOT_CALL_LIST," +
                                          "CALLBACK=@CALLBACK," +
                                          "CIC=@CIC," +
                                          "DURATION=@DURATION," +
                                          "NOTES=@NOTES," +
                                          "FOLLOW_UP=@FOLLOW_UP," +
                                          "STATUS=@STATUS," +
                                          "CAMPAIGN_CATEGORY_ID=@CAMPAIGN_CATEGORY_ID " +
                                          "WHERE ID=@ID";
                param.Add("@MODIFIED_USER_ID", UserId);
                param.Add("@DATE_MODIFIED", DateTime.Now);
                param.Add("@NAME", input.NAME);
                param.Add("@NOTES", input.NOTES);
                param.Add("@DO_NOT_CALL_LIST", input.DO_NOT_CALL_LIST);
                param.Add("@CALLBACK", input.CALLBACK);
                param.Add("@CIC", input.CIC);
                param.Add("@DURATION", input.DURATION);
                param.Add("@FOLLOW_UP", input.FOLLOW_UP);
                param.Add("@CALL_RESULT_ID", input.CALL_RESULT_ID);
                param.Add("@CAMPAIGN_CATEGORY_ID", (string.IsNullOrEmpty(input.CAMPAIGN_CATEGORY_ID) ? null : input.CAMPAIGN_CATEGORY_ID));
                param.Add("@STATUS", input.STATUS);
                param.Add("@ID", input.ID);

                DapperORM.Execute(sql, param);

                sql = "UPDATE CALL_REASON_CSTM SET " +
                      "RECALL_TIME_C=@RECALL_TIME_C " +
                      "WHERE ID_C=@ID";
                param.Add("@ID", input.ID);
                param.Add("@RECALL_TIME_C", input.RECALL_TIME_C);
                DapperORM.Execute(sql, param);

                return(new { data = input.ID });
            }
            catch (Exception ex)
            {
                return(new { data = new { Message = ex.Message, ErrorCode = 600 } });
            }
        }
Exemplo n.º 3
0
        public object CreateCallReason(CreateOrEditCallReasonDto input, string UserId)
        {
            try
            {
                DynamicParameters param = new DynamicParameters();
                String            sql   = "INSERT INTO CALL_REASON (" +
                                          "ID," +
                                          "CREATED_BY," +
                                          "DATE_ENTERED," +
                                          "MODIFIED_USER_ID," +
                                          "DATE_MODIFIED," +
                                          "NAME," +
                                          "CALL_RESULT_ID," +
                                          "DO_NOT_CALL_LIST," +
                                          "CALLBACK," +
                                          "CIC," +
                                          "DURATION," +
                                          "NOTES," +
                                          "FOLLOW_UP," +
                                          "STATUS," +
                                          "CAMPAIGN_CATEGORY_ID) " +
                                          "VALUES (" +
                                          "@ID," +
                                          "@CREATED_BY," +
                                          "@DATE_ENTERED," +
                                          "@MODIFIED_USER_ID," +
                                          "@DATE_MODIFIED," +
                                          "@NAME," +
                                          "@CALL_RESULT_ID," +
                                          "@DO_NOT_CALL_LIST," +
                                          "@CALLBACK," +
                                          "@CIC," +
                                          "@DURATION," +
                                          "@NOTES," +
                                          "@FOLLOW_UP," +
                                          "@STATUS," +
                                          "@CAMPAIGN_CATEGORY_ID)";
                var Id = Guid.NewGuid().ToString();
                param.Add("@ID", Id);
                param.Add("@CREATED_BY", UserId);
                param.Add("@DATE_ENTERED", DateTime.Now);
                param.Add("@MODIFIED_USER_ID", UserId);
                param.Add("@DATE_MODIFIED", DateTime.Now);
                param.Add("@NAME", input.NAME);
                param.Add("@NOTES", input.NOTES);
                param.Add("@DO_NOT_CALL_LIST", input.DO_NOT_CALL_LIST);
                param.Add("@CALLBACK", input.CALLBACK);
                param.Add("@CIC", input.CIC);
                param.Add("@DURATION", input.DURATION);
                param.Add("@FOLLOW_UP", input.FOLLOW_UP);
                param.Add("@CALL_RESULT_ID", input.CALL_RESULT_ID);
                param.Add("@CAMPAIGN_CATEGORY_ID", (string.IsNullOrEmpty(input.CAMPAIGN_CATEGORY_ID) ? null : input.CAMPAIGN_CATEGORY_ID));
                param.Add("@STATUS", input.STATUS);
                DapperORM.Execute(sql, param);

                sql = "INSERT INTO CALL_REASON_CSTM(ID_C,RECALL_TIME_C) Values(@ID,@RECALL_TIME_C)";
                param.Add("@ID", Id);
                param.Add("@RECALL_TIME_C", input.RECALL_TIME_C);
                DapperORM.Execute(sql, param);
                return(new { data = Id });
            }
            catch (Exception ex)
            {
                return(new { data = new { Message = ex.Message, ErrorCode = 600 } });
            }
        }