Esempio n. 1
0
        /// <summary>
        /// Description  : Get WOAddress Details from database.
        /// Created By   : Pavan
        /// Created Date : 12 August 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static List<WOAddress> GetWOAddressDetails(int PersonID, string PersonSource)
        {
            var data = new List<WOAddress>();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@PersonID", PersonID);
                sqlParams[1] = new SqlParameter("@PersonSource", PersonSource);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetWOAddressDetails]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var woaddress = new WOAddress();
                    woaddress.FetchwoaddressDetails(woaddress, safe);
                    data.Add(woaddress);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
 public JsonResult InsertOrUpdateDirectorAddress(int PersonId, string SourceCode, string DirectorEmail, string DirectorContactNo, string DirectorFax)
 {
     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 WOAddress
             {
                 PersonID = PersonId,
                 PersonSource = SourceCode,
                 Email = DirectorEmail,
                 Phone = DirectorContactNo,
                 Fax = DirectorFax
             };
             int result = data.InsertOrUpdateDirectorAddress(createdBy);
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
Esempio n. 3
0
 private WOAddress FetchwoaddressDetails(WOAddress woaddress, SafeDataReader dr)
 {
     woaddress.Email = dr.GetString("Email");
     woaddress.Phone = dr.GetString("Phone");
     woaddress.Fax = dr.GetString("Fax");
     return woaddress;
 }