public JsonResult CreateCorporation(Corporation Corporation)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         Int32 returnValue = 0;
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(returnValue);
         }
         else
         {
             int createdBy = Convert.ToInt32(Session["UserID"]);
             //var data = new Corporation
             //{
             //    ID = ID,
             //    NameOfCompany = NameOfCompany,
             //    CountryOfIncorporation = CountryOfIncorporation,
             //    DateOfIncorporation = DateOfIncorporation,
             //    RegistrationNo = RegistrationNo,
             //    AccPacCode = AccPacCode,
             //    AddressLine1 = AdderessLine1,
             //    AddressLine2 = AddressLine2,
             //    AddressLine3 = AddressLine3,
             //    Country = Country,
             //    PostalCode = PostalCode,
             //    Email = Email,
             //    ContactNo = ContactNo,
             //    Fax = Fax,
             //    createdBy = createdBy
             //};
             Corporation.createdBy = createdBy;
             int result = Corporation.InsertCorporation();
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
예제 #2
0
 /// <summary>
 /// Created By    : Shiva
 /// Created Date  : 16 Oct 2014
 /// Modified By   :  
 /// Modified Date :  
 /// Description   : To Get Corporation Details by ID
 /// </summary>    
 public static CorporationInfo GetCorporationDetailsByID(int ID)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     var data = new CorporationInfo();
     try
     {
         SqlParameter[] sqlParams = new SqlParameter[1];
         sqlParams[0] = new SqlParameter("@ID", ID);
         var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetCorporationDetailsByID", sqlParams);
         while (reader.Read())
         {
             var safe = new SafeDataReader(reader);
             var Corporation = new Corporation();
             Corporation.FetchCorporation(Corporation, safe);
             data.CorporationList.Add(Corporation);
         }
         return data;
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return data;
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
예제 #3
0
 private Corporation FetchCorporation(Corporation Corporation, SafeDataReader dr)
 {
     Corporation.ID = dr.GetInt32("ID");
     Corporation.NameOfCompany = dr.GetString("NameOfCompany");
     Corporation.CountryOfIncorporation = dr.GetInt32("CountryOfIncorporation");
     Corporation.CountryNameOfIncorp = dr.GetString("CountryNameOfIncorp");
     Corporation.DateOfIncorporation = dr.GetDateTime("DateOfIncorporation").ToString("dd/MM/yyyy") == "01/01/0001" ? "" : dr.GetDateTime("DateOfIncorporation").ToString("dd/MM/yyyy");
     Corporation.DateOfIncorporationList = Corporation.DateOfIncorporation == "" ? "" : dr.GetDateTime("DateOfIncorporation").ToString("dd MMM yyyy");
     Corporation.RegistrationNo = dr.GetString("RegistrationNo");
     Corporation.AccPacCode = dr.GetString("AccpacCode");
     Corporation.AddressLine1 = dr.GetString("AddressLine1");
     Corporation.AddressLine2 = dr.GetString("AddressLine2");
     Corporation.AddressLine3 = dr.GetString("AddressLine3");
     Corporation.Country = dr.GetInt32("Country");
     Corporation.CountryName = dr.GetString("CountryName");
     Corporation.PostalCode = dr.GetString("PostalCode");
     Corporation.Email = dr.GetString("Email");
     Corporation.ContactNo = dr.GetString("Phone");
     Corporation.Fax = dr.GetString("Fax");
     return Corporation;
 }
예제 #4
0
        /// <summary>
        /// Description   : To Get Company Data
        /// Created By    : Pavan
        /// Created Date  : 30 September 2014
        /// Modified By   :  
        /// Modified Date :  
        /// <returns></returns>
        /// </summary>
        public static CorporationInfo GetAllCorporationData(string CompanyName, string OrderBy, int startPage, int resultPerPage)
        {
            var data = new CorporationInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[4];
                sqlParams[0] = new SqlParameter("@startPage", startPage);
                sqlParams[1] = new SqlParameter("@resultPerPage", resultPerPage);
                sqlParams[2] = new SqlParameter("@CompanyName", CompanyName);
                sqlParams[3] = new SqlParameter("@OrderBy", OrderBy);

                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetAllCorporation]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Corporation = new Corporation();
                    Corporation.FetchCorporation(Corporation, safe);
                    data.CorporationList.Add(Corporation);
                    data.CorporationCount = Convert.ToInt32(reader["CorporationCount"]);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }