public static KeyValuePair <int, string> DeleteCorporateCompany(eCorporateCompanyM company)
        {
            try
            {
                using (OneFineRateEntities db = new OneFineRateEntities())
                {
                    SqlParameter[] MyParam = new SqlParameter[1];
                    MyParam[0] = new SqlParameter("@iCompanyId", company.iCompanyId);

                    var dataSet = SqlHelper.ExecuteDataset(db.Database.Connection.ConnectionString, CommandType.StoredProcedure, "uspDeleteCorporateCompany", MyParam);

                    int    statusId = -1;
                    string message  = string.Empty;

                    if (dataSet != null && dataSet.Tables[0] != null)
                    {
                        statusId = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
                        message  = Convert.ToString(dataSet.Tables[0].Rows[0][1]);
                    }

                    return(new KeyValuePair <int, string>(statusId, message));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult AddUpdateCompany(eCorporateCompanyM company)
        {
            if (ModelState.IsValid)
            {
                var domainNames = company.sDomainNames.Split(',');
                var domainType  = company.DomainType.ToString();

                company.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;

                if (company.iCompanyId != 0)
                {
                    company.sActionType = "E";
                }
                else
                {
                    company.cStatus     = "A";
                    company.sActionType = "A";
                }

                DataTable dtTblDomainNames = new DataTable();

                var domainNameColumn = new DataColumn("sDomainName", typeof(string));
                var domainTypeColumn = new DataColumn("sDomainType", typeof(string));

                dtTblDomainNames.Columns.Add(domainNameColumn);
                dtTblDomainNames.Columns.Add(domainTypeColumn);

                foreach (var item in domainNames)
                {
                    if (!string.IsNullOrEmpty(item))
                    {
                        DataRow domainNameRow = dtTblDomainNames.NewRow();
                        domainNameRow["sDomainName"] = item;
                        domainNameRow["sDomainType"] = domainType;
                        dtTblDomainNames.Rows.Add(domainNameRow);
                    }
                }

                company.DomainDataTable = dtTblDomainNames;

                var result = BL_CorporateCompanyM.AddEditCorporateCompany(company);

                if (result.Key == -1)
                {
                    return(Json(new { status = false, Msg = result.Value }, JsonRequestBehavior.AllowGet));
                }
                else if (result.Key == 1)
                {
                    return(Json(new { status = true, Msg = result.Value }, JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(new { status = false, Msg = "An error occured while adding the record, Kindly try after some time." }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddUpdateCompany(int?id)
        {
            var model = new eCorporateCompanyM();

            if (id.HasValue)
            {
                model = BL_CorporateCompanyM.GetCorporateCompanyById(id.Value);
            }
            else
            {
                model.CountryCodePhoneList = BL_Country.GetAllCountryPhoneCodes();
            }

            return(PartialView("_AddCompany", model));
        }
        public static KeyValuePair <int, string> AddEditCorporateCompany(eCorporateCompanyM company)
        {
            try
            {
                using (OneFineRateEntities db = new OneFineRateEntities())
                {
                    SqlParameter[] MyParam = new SqlParameter[18];
                    MyParam[0] = new SqlParameter("@iCompanyId", company.iCompanyId);
                    MyParam[1] = new SqlParameter("@sCompanyName", company.sCompanyName);
                    MyParam[2] = new SqlParameter("@sPrimaryContact", company.sPrimaryContact);
                    MyParam[3] = new SqlParameter("@sTelephoneNumber", company.sTelephoneNumber);
                    MyParam[4] = new SqlParameter("@sEmailAddress", company.sEmailAddress);
                    MyParam[5] = new SqlParameter("@sMobileNumber", company.sMobileNumber);
                    MyParam[6] = new SqlParameter("@domain", company.DomainDataTable);
                    MyParam[7] = new SqlParameter("@sActionType", company.sActionType);
                    MyParam[8] = new SqlParameter("@cStatus", company.cStatus);
                    MyParam[9] = new SqlParameter("@iActionBy", company.iActionBy);

                    MyParam[10] = new SqlParameter("@sEntityType", company.GstnEntityType);
                    MyParam[11] = new SqlParameter("@sRegisteredEntityName", company.GstnEntityName);
                    MyParam[12] = new SqlParameter("@sGstinNumber", company.GstnNumber);
                    MyParam[13] = new SqlParameter("@sPINCode", company.PinCode);
                    MyParam[14] = new SqlParameter("@iCountryId", company.CountryId);
                    MyParam[15] = new SqlParameter("@iStateId", company.StateId);
                    MyParam[16] = new SqlParameter("@iCityId", company.CityId);
                    MyParam[17] = new SqlParameter("@sAddress", company.Address);

                    var dataSet = SqlHelper.ExecuteDataset(db.Database.Connection.ConnectionString, CommandType.StoredProcedure, "uspAddUpdateDeleteCorporateCompany", MyParam);

                    int    statusId = -1;
                    string message  = string.Empty;

                    if (dataSet != null && dataSet.Tables[0] != null)
                    {
                        statusId = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
                        message  = Convert.ToString(dataSet.Tables[0].Rows[0][1]);
                    }

                    return(new KeyValuePair <int, string>(statusId, message));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        public ActionResult BecomeCorporate(eCorporateCompanyM model)
        {
            try
            {
                model.dtActionDate = DateTime.Now;

                if (!string.IsNullOrEmpty(model.sEmailAddress))
                {
                    TempData["msg"] = "Thank you for your Registration. Our executive will contact you shortly.";

                    string sToEmail  = model.sEmailAddress;
                    string sCcEmail  = "";
                    string sBCcEmail = "";
                    string sSubject  = "Become Corporate Application Submitted Successfully";
                    string sBody     = "Your application has been submitted successfully. Thank you.";
                    MailComponent.SendEmail(sToEmail, sCcEmail, sBCcEmail, sSubject, sBody, null, null, true, null, null);

                    string adminEmail     = BL_tblHotelPartner.GetPartnerEmailId();
                    string adminsCcEmail  = "";
                    string adminsBCcEmail = "";
                    string adminsSubject  = "Corporate Partner Application Submitted Successfully";
                    string adminsBody     = "<table border='1'>";
                    adminsBody += "<tr><td>Company Name: </td><td>" + model.sCompanyName + "</td>";
                    adminsBody += "<tr><td>Email Address: </td><td>" + model.sEmailAddress + "</td>";
                    adminsBody += "<tr><td>Telephone Number: </td><td>" + model.sTelephoneNumber + "</td>";
                    adminsBody += "<tr><td>Mobile Number: </td><td>" + model.sMobileNumber + "</td>";
                    //adminsBody += "<tr><td>Action Date: </td><td>" + DateTime.Now + "</td>";
                    adminsBody += "</table>";
                    MailComponent.SendEmail(adminEmail, adminsCcEmail, adminsBCcEmail, adminsSubject, adminsBody, null, null, true, null, null);
                }
                else
                {
                    ModelState.AddModelError("", "Email Address Required!");
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex);
                return(View(model));
            }
            ModelState.Clear();
            return(View());
        }
        public ActionResult DeleteCompany(int id)
        {
            if (ModelState.IsValid)
            {
                var company = new eCorporateCompanyM();
                company.iCompanyId = id;

                var result = BL_CorporateCompanyM.DeleteCorporateCompany(company);

                if (result.Key == -1)
                {
                    return(Json(new { status = false, Msg = result.Value }, JsonRequestBehavior.AllowGet));
                }
                else if (result.Key == 1)
                {
                    return(Json(new { status = true, Msg = result.Value }, JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(new { status = false, Msg = "An error occured while deleting the record, Kindly try after some time." }, JsonRequestBehavior.AllowGet));
        }
        public static eCorporateCompanyM GetCorporateCompanyById(int companyId)
        {
            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var m = db.tblCorporateCompanyMs.Where(x => x.iCompanyId == companyId).FirstOrDefault();

                var companyModel = new eCorporateCompanyM();

                var sDomainNames = string.Join(",", m.tblCorporateDomainMaps.Select(y => y.sDomainName));
                var domainType   = m.tblCorporateDomainMaps.Select(y => y.sDomainType).FirstOrDefault() == DomainType.Domain.ToString() ? DomainType.Domain : DomainType.Email;

                companyModel.iCompanyId       = m.iCompanyId;
                companyModel.sCompanyName     = m.sCompanyName;
                companyModel.sDomainNames     = sDomainNames;
                companyModel.DomainType       = domainType;
                companyModel.sEmailAddress    = m.sEmailAddress;
                companyModel.sMobileNumber    = m.sMobileNumber;
                companyModel.sPrimaryContact  = m.sPrimaryContact;
                companyModel.sTelephoneNumber = m.sTelephoneNumber;
                companyModel.cStatus          = m.cStatus;
                companyModel.dtActionDate     = m.dtActionDate;
                companyModel.iActionBy        = m.iActionBy;
                companyModel.GstnEntityType   = m.sEntityType;
                companyModel.GstnEntityName   = m.sRegisteredEntityName;
                companyModel.GstnNumber       = m.sGstinNumber;
                companyModel.PinCode          = m.sPINCode;
                companyModel.CountryId        = m.iCountryId;
                companyModel.StateId          = m.iStateId;
                companyModel.CityId           = m.iCityId;
                companyModel.Address          = m.sAddress;

                companyModel.CountryCodePhoneList = BL_Country.GetAllCountryPhoneCodes();

                return(companyModel);
            }
        }