private Cessionofficers FetchPositionDetails(Cessionofficers Directors, SafeDataReader dr)
 {
     Directors.Name = dr.GetString("Director Name");
     Directors.Position = dr.GetString("Position");
     Directors.Email = dr.GetString("Email");
     Directors.ContactNo = dr.GetString("Phone");
     Directors.Fax = dr.GetString("Fax");
     return Directors;
 }
 public JsonResult InsertCessationDirectors(Cessionofficers cessationdetails)
 {
     System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
     System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
     log.Debug("Start: " + methodBase.Name);
     try
     {
         int checkSession = UserLogin.AuthenticateRequest();
         if (checkSession == 0)
         {
             return Json(checkSession);
         }
         else
         {
             int createdBy = Convert.ToInt32(Session["UserID"]);
             int result = Cessionofficers.InsertCessationDirectors(cessationdetails, createdBy);
             return Json(result);
         }
     }
     catch (Exception ex)
     {
         log.Error("Error: " + ex);
         return Json("");
     }
     finally
     {
         log.Debug("End: " + methodBase.Name);
     }
 }
 private Cessionofficers FetchCessationOfficers(Cessionofficers Directors, SafeDataReader dr)
 {
     Directors.ID = dr.GetInt32("CessionID");
     Directors.Name = dr.GetString("Cessation Officer");
     Directors.DateofResignation = dr.GetString("Date Of Resignation");
     Directors.Position = dr.GetString("Position");
     //  Directors.DependingDirector = dr.GetString("Depending Director");
     Directors.Email = dr.GetString("Email");
     Directors.ContactNo = dr.GetString("Phone");
     Directors.Fax = dr.GetString("Fax");
     Directors.NatureAppoint = dr.GetInt32("NatureAppoint");
     Directors.IsExistsChildPerson = dr.GetInt32("IsExistsChildPerson");
     return Directors;
 }
 private Cessionofficers CessationDirectors(Cessionofficers Directors, SafeDataReader dr)
 {
     Directors.ID = dr.GetInt32("ID");
     Directors.Name = dr.GetString("Name");
     Directors.SourceCode = dr.GetString("SourceCode");
     return Directors;
 }
        /// <summary>
        /// Description  : Get Directors Details from database.
        /// Created By   : Sudheer
        /// Created Date : 20 Nov 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>           
        public static int InsertCessationDirectors(Cessionofficers cessationdetails, int CreatedBy)
        {
            int Rerurn = -1;
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {

                SqlParameter[] sqlParams = new SqlParameter[12];
                sqlParams[0] = new SqlParameter("@ClientID", cessationdetails.ClientID);
                sqlParams[1] = new SqlParameter("@ClientSourceID", cessationdetails.ClientSourceID);
                sqlParams[2] = new SqlParameter("@NatureAppoint", cessationdetails.NatureAppoint);
                sqlParams[3] = new SqlParameter("@WOID", cessationdetails.WOID);
                sqlParams[4] = new SqlParameter("@DependingDirectorID", cessationdetails.DependingDirectorID);
                sqlParams[5] = new SqlParameter("@DependingDirectorSource", cessationdetails.DependingDirectorSource);
                sqlParams[6] = new SqlParameter("@DateofResignation", HelperClasses.ConvertDateFormat(cessationdetails.DateofResignation));
                sqlParams[7] = new SqlParameter("@Email", cessationdetails.Email);
                sqlParams[8] = new SqlParameter("@ContactNo", cessationdetails.ContactNo);
                sqlParams[9] = new SqlParameter("@Fax", cessationdetails.Fax);
                sqlParams[10] = new SqlParameter("@CreatedBy", CreatedBy);

                sqlParams[11] = new SqlParameter("@Output", 0);
                sqlParams[11].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpInsertCessationOfficer]", sqlParams);

                Rerurn = Convert.ToInt16(sqlParams[11].Value);

                return Rerurn;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return Rerurn;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
        /// <summary>
        /// Created By   : Sudheer
        /// Created Date : 21 Nov 2014
        /// Modified By  :
        /// Modified Date:
        /// Description  : Get Cessionofficers Details by WOID
        /// </summary>
        /// <returns></returns>
        public static CessionofficersInfo GetWOCessionofficersPossionDetails(int CessId)
        {
            var GetWOCessionData = new CessionofficersInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@CessId", CessId);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetCessionofficersPossionDetails", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Details = new Cessionofficers();
                    Details.FetchPositionDetails(Details, safe);
                    GetWOCessionData.DirectorsList.Add(Details);
                }
                return GetWOCessionData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return GetWOCessionData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
        /// <summary>
        /// Description  : Get Directors Details from database.
        /// Created By   : Sudheer
        /// Created Date : 20 Nov 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static CessionofficersInfo GetCessationDirectors(int WOID, int DirectorID, string DirectorSource, int NatureAppoint)
        {
            var data = new CessionofficersInfo();

            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("@WOID", WOID);
                sqlParams[1] = new SqlParameter("@DirctorID", DirectorID);
                sqlParams[2] = new SqlParameter("@DirectorSource", DirectorSource);
                sqlParams[3] = new SqlParameter("@NatureofOppintment", NatureAppoint);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetDirectorDetailsforCessationOfficer]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var directors = new Cessionofficers();
                    directors.CessationDirectors(directors, safe);
                    data.DirectorsList.Add(directors);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }