Ejemplo n.º 1
0
        public HttpResponseMessage PostSetAgencyBranchUpdate(CreateNewBranchStep1 _objBranchUpdateA)
        {
            AgencyDAL _objAgencyDAL = new AgencyDAL();
            Response  objResponse   = new Response();

            try
            {
                var jsonResult = new StringBuilder();
                jsonResult = _objAgencyDAL.SetUpdateBranchDetails(_objBranchUpdateA);

                objResponse.Data = jsonResult.ToString();
                if (!string.IsNullOrEmpty(jsonResult.ToString()) && jsonResult.ToString() != "-2000")
                {
                    objResponse.Success = true;
                }
                else
                {
                    objResponse.Success = false;
                }

                return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
            }
            catch (Exception ex)
            {
                #region set exception response
                string logMsg = Environment.NewLine + DateTime.Now + Environment.NewLine + "Method Name: SetAgencyBranchUpdate | Contoller Name: Agency Controller" + Environment.NewLine;
                logMsg += "Temp Reg ID:" + _objBranchUpdateA.AgencyID + "|" + DateTime.Now + "|" + ex.ToString() + "-" + Environment.NewLine;
                ErrorHandler.ErrorLog(logMsg);
                #endregion
                objResponse.Success = false;
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, objResponse);
                return(response);
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage PostGetAgencyBranchUpdate(CreateNewBranchStep1 _objGetBranchUpdateA)
        {
            AgencyDAL            _objAgencyDAL            = new AgencyDAL();
            Response             objResponse              = new Response();
            CreateNewBranchStep1 _objCreateNewBranchStep1 = new CreateNewBranchStep1();

            try
            {
                DataSet dsResult = new DataSet();
                string  jsonData = string.Empty;
                dsResult = _objAgencyDAL.GetAgencyBranchUpdate(_objGetBranchUpdateA);

                if (dsResult != null)
                {
                    if (dsResult.Tables[0] != null)
                    {
                        if (dsResult.Tables[0].Rows.Count > 0)
                        {
                            _objCreateNewBranchStep1.AgencyBranchID = dsResult.Tables[0].Rows[0]["AgencyBranchID"].ToString();
                            _objCreateNewBranchStep1.AgencyID       = dsResult.Tables[0].Rows[0]["AgencyID"].ToString();
                            _objCreateNewBranchStep1.BranchName     = dsResult.Tables[0].Rows[0]["BranchName"].ToString();
                            _objCreateNewBranchStep1.AddressLine1   = dsResult.Tables[0].Rows[0]["Address1"].ToString();
                            _objCreateNewBranchStep1.AddressLine2   = dsResult.Tables[0].Rows[0]["Address2"].ToString();
                            _objCreateNewBranchStep1.State          = dsResult.Tables[0].Rows[0]["StateID"].ToString();
                            _objCreateNewBranchStep1.City           = dsResult.Tables[0].Rows[0]["CityID"].ToString();
                            _objCreateNewBranchStep1.POBoxNo        = dsResult.Tables[0].Rows[0]["Pincode"].ToString();
                            _objCreateNewBranchStep1.IncID          = common.EncodeTo64(dsResult.Tables[0].Rows[0]["AgencyBranchID"].ToString());
                        }
                        objResponse.Data    = _objCreateNewBranchStep1;
                        objResponse.Success = true;
                    }
                }
                else
                {
                    objResponse.Success = false;
                    objResponse.Data    = "-2";
                }

                return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
            }
            catch (Exception ex)
            {
                #region set exception response
                string logMsg = Environment.NewLine + DateTime.Now + Environment.NewLine + "Method Name: GetAgencyBranchUpdate | Contoller Name: Agency Controller" + Environment.NewLine;
                logMsg += "Temp Reg ID:" + _objGetBranchUpdateA.AgencyBranchID + "|" + DateTime.Now + "|" + ex.ToString() + "-" + Environment.NewLine;
                ErrorHandler.ErrorLog(logMsg);
                #endregion
                objResponse.Success = false;
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, objResponse);
                return(response);
            }
        }
Ejemplo n.º 3
0
 public DataSet GetNewBranchStep1(CreateNewBranchStep1 _objCreateNewBranchStep1A)
 {
     try
     {
         SqlParameter[] P = new SqlParameter[] {
             new SqlParameter("@TmpAgencyBranchID", _objCreateNewBranchStep1A.AgencyBranchID),
         };
         DataSet dtResult = new DataSet();
         dtResult = DataLib.GetStoredProcData(DataLib.Connection.GetConnectionString, SPKeys.SPGetTmpAgencyBranch, P);
         return(dtResult);
     }
     catch { throw; }
 }
Ejemplo n.º 4
0
        public StringBuilder SetNewBranchStep1(CreateNewBranchStep1 _objCreateNewBranchStep1A)
        {
            try
            {
                SqlParameter[] P = new SqlParameter[] {
                    new SqlParameter("@AgencyID", _objCreateNewBranchStep1A.AgencyID),
                    new SqlParameter("@BranchName", String.IsNullOrEmpty(_objCreateNewBranchStep1A.BranchName)?DBNull.Value:(object)_objCreateNewBranchStep1A.BranchName),
                    new SqlParameter("@Address1", String.IsNullOrEmpty(_objCreateNewBranchStep1A.AddressLine1)?DBNull.Value:(object)_objCreateNewBranchStep1A.AddressLine1),
                    new SqlParameter("@Address2", String.IsNullOrEmpty(_objCreateNewBranchStep1A.AddressLine2)?DBNull.Value:(object)_objCreateNewBranchStep1A.AddressLine2),
                    new SqlParameter("@StateID", String.IsNullOrEmpty(_objCreateNewBranchStep1A.State)?DBNull.Value:(object)_objCreateNewBranchStep1A.State),
                    new SqlParameter("@CityID", String.IsNullOrEmpty(_objCreateNewBranchStep1A.City)?DBNull.Value:(object)_objCreateNewBranchStep1A.City),
                    new SqlParameter("@POBox", String.IsNullOrEmpty(_objCreateNewBranchStep1A.POBoxNo)?DBNull.Value:(object)_objCreateNewBranchStep1A.POBoxNo),
                    new SqlParameter("@CreatedBy", String.IsNullOrEmpty(_objCreateNewBranchStep1A.CreatedBy)?DBNull.Value:(object)_objCreateNewBranchStep1A.CreatedBy),
                };

                var jsonResult = new StringBuilder();
                jsonResult = DataLib.JsonStringExecuteReader(DataLib.Connection.SetConnectionString, SPKeys.SPSetTmpAgencyBranch, P);
                return(jsonResult);
            }
            catch { throw; }
        }