Example #1
0
        public JsonResult InsertWOINCORPDetails(InCorpDetails incorpdetails)
        {
            int checkSession = UserLogin.AuthenticateRequest();
            if (checkSession == 0)
            {
                return Json(checkSession);
            }
            else
            {
                try
                {
                    incorpdetails.FinancialYearEnd = (incorpdetails.FinancialYearEnd != null ? HelperClasses.ConvertDateFormatDDMM(incorpdetails.FinancialYearEnd) : "");
                    incorpdetails.FirstFinancialYearEnd = (incorpdetails.FirstFinancialYearEnd != null ? Convert.ToDateTime(incorpdetails.FirstFinancialYearEnd).ToString("MM/dd/yyyy") : "");

                    int createdBy = Convert.ToInt32(Session["UserID"]);
                    int result = InCorpDetails.InsertWOInCorpDetails(incorpdetails, createdBy);
                    return Json(result);
                }
                catch (Exception ex)
                {
                    if (ex.Message.IndexOf("The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar") > -1 ||
                        ex.Message.IndexOf("String was not recognized as a valid DateTime.") > -1)
                        return Json(-2);
                    else
                        return Json(-1);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Description  : To Insert Work Order INCorpDetails.
        /// Created By   : Sudheer  
        /// Created Date : 30 July 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static int InsertWOInCorpDetails(InCorpDetails WOInCorpDetails, int CreatedBy)
        {
            int output = -2;

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[35];
                sqlParams[0] = new SqlParameter("@WOID", WOInCorpDetails.WOID);
                sqlParams[1] = new SqlParameter("@CompanyName", WOInCorpDetails.CompanyName);
                sqlParams[2] = new SqlParameter("@ClientNo", WOInCorpDetails.ClientNo);
                if (WOInCorpDetails.IncropDate == null)
                    sqlParams[3] = new SqlParameter("@IncropDate", DBNull.Value);
                else
                    sqlParams[3] = new SqlParameter("@IncropDate", HelperClasses.ConvertDateFormat(WOInCorpDetails.IncropDate));
                sqlParams[4] = new SqlParameter("@RegistrationNo", WOInCorpDetails.RegistrationNo);
                sqlParams[5] = new SqlParameter("@TypeofCompany", WOInCorpDetails.TypeofCompany);
                sqlParams[6] = new SqlParameter("@FMGasRegisteredAddress", WOInCorpDetails.FMGasRegisteredAddress);
                sqlParams[7] = new SqlParameter("@AddressLine1", WOInCorpDetails.AddressLine1);
                sqlParams[8] = new SqlParameter("@AddressLine2", WOInCorpDetails.AddressLine2);
                sqlParams[9] = new SqlParameter("@AddressLine3", WOInCorpDetails.AddressLine3);
                sqlParams[10] = new SqlParameter("@Country", WOInCorpDetails.Country);
                sqlParams[11] = new SqlParameter("@PostalCode", WOInCorpDetails.PostalCode);
                if (WOInCorpDetails.FinancialYearEnd == "")
                    sqlParams[12] = new SqlParameter("@FinancialYearEnd", DBNull.Value);
                else
                    sqlParams[12] = new SqlParameter("@FinancialYearEnd", WOInCorpDetails.FinancialYearEnd);

                if (WOInCorpDetails.FirstFinancialYearEnd == "")
                    sqlParams[13] = new SqlParameter("@FirstFinancialYearEnd", DBNull.Value);
                else
                    sqlParams[13] = new SqlParameter("@FirstFinancialYearEnd", WOInCorpDetails.FirstFinancialYearEnd);
                sqlParams[14] = new SqlParameter("@Currency", WOInCorpDetails.Currency);
                sqlParams[15] = new SqlParameter("@ClassofShare", WOInCorpDetails.ClassofShare);
                sqlParams[16] = new SqlParameter("@PaidupCapital", WOInCorpDetails.PaidupCapital);
                sqlParams[17] = new SqlParameter("@AmountPaidupperShare", WOInCorpDetails.AmountPaidupperShare);
                sqlParams[18] = new SqlParameter("@ActivityOne", WOInCorpDetails.ActivityOne);
                sqlParams[19] = new SqlParameter("@ActivityOneDescription", WOInCorpDetails.ActivityOneDescription);
                sqlParams[20] = new SqlParameter("@ActivityTwo", WOInCorpDetails.ActivityTwo);
                sqlParams[21] = new SqlParameter("@ActivityTwoDescription", WOInCorpDetails.ActivityTwoDescription);
                sqlParams[22] = new SqlParameter("@CreatedBy", CreatedBy);

                sqlParams[29] = new SqlParameter("@AmountGuaranteedByEachMember", WOInCorpDetails.AmountGuaranteedByEachMember);
                sqlParams[30] = new SqlParameter("@GuaranteedAmountCurrency", WOInCorpDetails.GuaranteedAmountCurrency);

                sqlParams[31] = new SqlParameter("@FMGClient ", WOInCorpDetails.FMGClient);
                sqlParams[32] = new SqlParameter("@ClientType", WOInCorpDetails.ClientType);
                sqlParams[33] = new SqlParameter("@IncorporationCountry", WOInCorpDetails.IncorporationCountry);
                sqlParams[34] = new SqlParameter("@CompanyStatus", WOInCorpDetails.CompanyStatus);

                output = SqlHelper.ExecuteNonQuery(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpInsertOrUpdateWOIncorpDetails]", sqlParams);
                return output;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return output;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Example #3
0
        private InCorpDetails FetchWOInCorp(InCorpDetails WOIncorpData, SafeDataReader dr)
        {
            WOIncorpData.WOID = dr.GetInt32("WOID");
            WOIncorpData.CompanyName = dr.GetString("CompanyName");
            WOIncorpData.ClientNo = dr.GetString("ClientNo");
            WOIncorpData.ClientID = dr.GetInt32("ClientID");
            WOIncorpData.ClientSource = dr.GetString("ClientSource");
            WOIncorpData.IncropDate = dr.GetDateTime("IncropDate").ToString("dd/MM/yyyy") == "01/01/0001" ? "" : dr.GetDateTime("IncropDate").ToString("dd/MM/yyyy");
            WOIncorpData.RegistrationNo = dr.GetString("RegistrationNo");
            WOIncorpData.TypeofCompany = dr.GetString("TypeofCompany");
            WOIncorpData.FMGasRegisteredAddress = dr.GetBoolean("FMGasRegisteredAddress");
            WOIncorpData.AddressLine1 = dr.GetString("AddressLine1");
            WOIncorpData.AddressLine2 = dr.GetString("AddressLine2");
            WOIncorpData.AddressLine3 = dr.GetString("AddressLine3");
            WOIncorpData.Country = dr.GetString("Country");
            WOIncorpData.PostalCode = dr.GetString("PostalCode");
            WOIncorpData.FinancialYearEnd = dr.GetDateTime("FinancialYearEnd").ToString("dd MMMM"); //== "01 January" ? "" : dr.GetDateTime("FinancialYearEnd").ToString("dd MMMM");
            WOIncorpData.FirstFinancialYearEnd = dr.GetDateTime("FirstFinancialYearEnd").ToString("dd MMMM yyyy") == "01 January 0001" ? "" : dr.GetDateTime("FirstFinancialYearEnd").ToString("dd MMMM yyyy");
            WOIncorpData.Currency = dr.GetString("Currency");
            WOIncorpData.ClassofShare = dr.GetString("ClassofShare");
            WOIncorpData.PaidupCapital = dr.GetDecimal("PaidupCapital");
            WOIncorpData.AmountPaidupperShare = dr.GetDecimal("AmountPaidupperShare");
            WOIncorpData.ActivityOne = dr.GetString("ActivityOne");
            WOIncorpData.ActivityOneDescription = dr.GetString("ActivityOneDescription");
            WOIncorpData.ActivityTwo = dr.GetString("ActivityTwo");
            WOIncorpData.ActivityTwoDescription = dr.GetString("ActivityTwoDescription");

            WOIncorpData.AmountGuaranteedByEachMember = dr.GetDecimal("AmountGuaranteedByEachMember");
            WOIncorpData.GuaranteedAmountCurrency = dr.GetString("GuaranteedAmountCurrency");

            WOIncorpData.FMGClient = dr.GetBoolean("FMGClient");
            WOIncorpData.ClientType = dr.GetInt32("ClientType");
            WOIncorpData.IncorporationCountry = dr.GetInt32("IncorporationCountry");
            WOIncorpData.CompanyStatus = dr.GetInt32("CompanyStatus");

            return WOIncorpData;
        }
Example #4
0
        /// <summary>
        /// Description  : To Get Work Order INCorpDetails.
        /// Created By   : Sudheer  
        /// Created Date : 30 July 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        public static InCorpDetails GetWOIncorpDetails(string WOID)
        {
            var WOIncorpData = new InCorpDetails();

            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("@WOID", WOID);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetWOIncorpDetails]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    WOIncorpData.FetchWOInCorp(WOIncorpData, safe);
                }

                //safe.NextResult();
                //while (reader.Read())
                //{
                //    WOIncorpData.CompanyName = Convert.ToString(safe["CompanyName"]);
                //    WOIncorpData.RegistrationNo = Convert.ToString(safe["RegistrationNo"]);
                //}

                return WOIncorpData;

            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return WOIncorpData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }