Ejemplo n.º 1
0
        public int SaveOrgnization(TenantDetailsBO Orgnization)
        {
            int orgni = 0;

            try
            {
                using (SqlConnection sqlCon = new SqlConnection(Constant.DBConnectionString))
                {
                    using (SqlCommand sqlCmd = new SqlCommand("sspSaveOrgnization", sqlCon))
                    {
                        sqlCon.Open();
                        sqlCmd.CommandType = CommandType.StoredProcedure;
                        sqlCmd.Parameters.Add(new SqlParameter("@TenantRegNo", Orgnization.OrgRegNo));
                        sqlCmd.Parameters.Add(new SqlParameter("@Address1", Orgnization.Address1));
                        sqlCmd.Parameters.Add(new SqlParameter("@PrimaryPhone", Orgnization.PrimaryPhone));
                        sqlCmd.Parameters.Add(new SqlParameter("@Country", Orgnization.Country));
                        sqlCmd.Parameters.Add(new SqlParameter("@AlternatePhone", Orgnization.AlternatePhone));
                        sqlCmd.Parameters.Add(new SqlParameter("@Email", Orgnization.Email));
                        sqlCmd.Parameters.Add(new SqlParameter("@Fax", Orgnization.Fax));
                        sqlCmd.Parameters.Add(new SqlParameter("@TenantID", Orgnization.TenantID));
                        sqlCmd.Parameters.Add(new SqlParameter("@Logo", Orgnization.Logo));

                        SqlDataReader reader = sqlCmd.ExecuteReader();
                        reader.Close();
                        reader = null;
                    }
                    sqlCon.Close();
                }
            }

            catch (Exception ex)
            {
                strErrorMsg = ex.Message;

                throw;
            }

            return(orgni);
        }
Ejemplo n.º 2
0
        public TenantDetailsBO getTenantDetails(int TenantID)
        {
            TenantDetailsBO tenantDetBO = new TenantDetailsBO();

            using (SqlConnection connection = new SqlConnection(Constant.DBConnectionString))
            {
                SqlCommand command = new SqlCommand("select * from tblTenantProfile where TenantID = @TenantID", connection);
                {
                    command.Parameters.Add(new SqlParameter("@TenantID", TenantID));
                    command.CommandType = CommandType.Text;

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            tenantDetBO.TenantCode         = reader["TenantCode"] == DBNull.Value ? string.Empty : Convert.ToString(reader["TenantCode"]);
                            tenantDetBO.TenantName         = reader["TenantName"] == DBNull.Value ? string.Empty : Convert.ToString(reader["TenantName"]);
                            tenantDetBO.TenantType         = reader["TenantType"] == DBNull.Value ? string.Empty : Convert.ToString(reader["TenantType"]);
                            tenantDetBO.ParentTenantID     = reader["ParentTenantID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["ParentTenantID"]);
                            tenantDetBO.TaxID              = reader["TaxID"] == DBNull.Value ? string.Empty : Convert.ToString(reader["TaxID"]);
                            tenantDetBO.InCorpState        = reader["InCorpState"] == DBNull.Value ? string.Empty : Convert.ToString(reader["InCorpState"]);
                            tenantDetBO.Address1           = reader["Address1"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Address1"]);
                            tenantDetBO.Address2           = reader["Address2"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Address2"]);
                            tenantDetBO.City               = reader["City"] == DBNull.Value ? string.Empty : Convert.ToString(reader["City"]);
                            tenantDetBO.State              = reader["State"] == DBNull.Value ? string.Empty : Convert.ToString(reader["State"]);
                            tenantDetBO.Zip                = reader["Zip"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Zip"]);
                            tenantDetBO.Country            = reader["Country"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Country"]);
                            tenantDetBO.Website            = reader["Website"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Website"]);
                            tenantDetBO.PrimaryPhone       = reader["PrimaryPhone"] == DBNull.Value ? string.Empty : Convert.ToString(reader["PrimaryPhone"]);
                            tenantDetBO.AlternatePhone     = reader["AlternatePhone"] == DBNull.Value ? string.Empty : Convert.ToString(reader["AlternatePhone"]);
                            tenantDetBO.Fax                = reader["Fax"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Fax"]);
                            tenantDetBO.Email              = reader["Email"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Email"]);
                            tenantDetBO.Logo               = reader["Logo"] == DBNull.Value ? string.Empty : Convert.ToString(reader["Logo"]);
                            tenantDetBO.SmallLogo          = reader["SmallLogo"] == DBNull.Value ? string.Empty : Convert.ToString(reader["SmallLogo"]);
                            tenantDetBO.DomainPrefix       = reader["DomainPrefix"] == DBNull.Value ? string.Empty : Convert.ToString(reader["DomainPrefix"]);
                            tenantDetBO.TenantAdminID      = reader["TenantAdminID"] == DBNull.Value ? 0 : Convert.ToInt32(reader["TenantAdminID"]);
                            tenantDetBO.TenantStatus       = reader["TenantStatus"] == DBNull.Value ? string.Empty : Convert.ToString(reader["TenantStatus"]);
                            tenantDetBO.ProfileCreatedOn   = reader["ProfileCreatedOn"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(reader["ProfileCreatedOn"]);
                            tenantDetBO.CreatedFromIP      = reader["CreatedFromIP"] == DBNull.Value ? string.Empty : Convert.ToString(reader["CreatedFromIP"]);
                            tenantDetBO.GeoRegion          = reader["GeoRegion"] == DBNull.Value ? string.Empty : Convert.ToString(reader["GeoRegion"]);
                            tenantDetBO.BillAddress1       = reader["BillAddress1"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillAddress1"]);
                            tenantDetBO.BillAddress2       = reader["BillAddress2"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillAddress2"]);
                            tenantDetBO.BillCity           = reader["BillCity"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillCity"]);
                            tenantDetBO.BillZipCode        = reader["BillZipCode"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillZipCode"]);
                            tenantDetBO.BillState          = reader["BillState"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillState"]);
                            tenantDetBO.BillCountry        = reader["BillCountry"] == DBNull.Value ? string.Empty : Convert.ToString(reader["BillCountry"]);
                            tenantDetBO.IsProfileComplete  = reader["IsProfileComplete"] == DBNull.Value ? false : Convert.ToBoolean(reader["IsProfileComplete"]);
                            tenantDetBO.ContactUsTelephone = reader["ContactUsTelephone"] == DBNull.Value ? string.Empty : Convert.ToString(reader["ContactUsTelephone"]);
                            tenantDetBO.ContactUsEmailID   = reader["ContactUsEmailID"] == DBNull.Value ? string.Empty : Convert.ToString(reader["ContactUsEmailID"]);
                        }
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(tenantDetBO);
        }
Ejemplo n.º 3
0
        public HttpResponseMessage Post([FromBody] KitOrder kitOrder /*string LastName, string PersionType, string OrgName, string Address, string City, string State, string Country, string Zip, string Telephone, string Email, string Message, string AuthenticateToken*/)
        {
            ApiDA apiDA = new ApiDA();
            HttpResponseMessage responce = new HttpResponseMessage();

            // bool isEntity=apiDA.CheckEntity(kitOrder.AuthenticateToken);
            int TenantID = apiDA.CheckEntity(kitOrder.AuthenticateToken);

            if (TenantID > 0)
            {
                CustomerBO cutomerBo = new CustomerBO
                {
                    FirstName     = kitOrder.FirstName.Trim(),
                    LastName      = kitOrder.LastName.Trim(),
                    TenantID      = TenantID,
                    Address1      = kitOrder.Address.Trim(),
                    City          = kitOrder.City.Trim(),
                    State         = kitOrder.State.Trim(),
                    Zipcode       = kitOrder.Zip.Trim(),
                    Email         = kitOrder.Email.Trim(),
                    Message       = kitOrder.Message.Trim(),
                    RequesterType = kitOrder.RequesterType.Trim(),
                    Facility      = kitOrder.OrgName.Trim(),
                    Country       = kitOrder.Country.Trim(),
                    Phone         = kitOrder.Telephone.Trim(),
                    CustID        = 0,
                };

                //if (btnSubmit.OnClientClick ="true")
                //{
                //    lblSubmit.Text = "SuccessMessage";
                //}
                //string message = "Your details have been saved successfully.";
                //string script = "window.onload = function(){ alert('";
                //script += message;
                //script += "')};";
                //ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);


                ApiDA customerDA = new ApiDA();
                int   customerNo = customerDA.SaveCustomerNumber(cutomerBo);

                //Save and Edit request Details
                if (customerNo > 0)
                {
                    OrderRequestBO ordreqBO = new ApiDA().SaveOrderRequest(new OrderRequestBO
                    {
                        RequestID      = Convert.ToInt32(0),
                        TenantID       = TenantID,
                        NoOfKits       = Convert.ToInt32(kitOrder.NoOfKits),
                        KitType        = "Frat",
                        CustomerNumber = customerNo.ToString(),
                    });

                    try
                    {
                        OrderKitBO      okBO           = new OrderKitBO();
                        TenantDetailsBO tenantDetailBO = new TenantDetailsBO();
                        tenantDetailBO = new ApiDA().getTenantDetails(TenantID);

                        string ordNumber = ordreqBO.RequestNumber;
                        List <EmailEnablementImplementationBO> emailBO = new ApiDA().emailEnableImplementation(TenantID, 1);
                        if (emailBO[0].emailEnablementBO.isToTenant == true)
                        {
                            emailBO[0].emailEnablementTypeBO.TenantTemplate = emailBO[0].emailEnablementTypeBO.TenantTemplate.Replace("@TenantName", tenantDetailBO.TenantName);
                            emailBO[0].emailEnablementTypeBO.TenantTemplate = emailBO[0].emailEnablementTypeBO.TenantTemplate.Replace("@End-userName", (kitOrder.FirstName.Trim() + " " + kitOrder.LastName.Trim()));
                            emailBO[0].emailEnablementTypeBO.TenantTemplate = emailBO[0].emailEnablementTypeBO.TenantTemplate.Replace("@Date:Time", DateTime.Now.ToShortDateString());
                            emailBO[0].emailEnablementTypeBO.TenantTemplate = emailBO[0].emailEnablementTypeBO.TenantTemplate.Replace("@RequestID", ordNumber);

                            EmailConfigBO ema = new EmailConfigBO();
                            ema.Body      = emailBO[0].emailEnablementTypeBO.TenantTemplate;
                            ema.Subject   = "Order Confirmation";
                            ema.ToAddress = emailBO[0].emailEnablementBO.ToTenantEmails;
                            SendEmail(ema);
                        }

                        if (emailBO[0].emailEnablementBO.isToEndUser == true)
                        {
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@End-userName", (kitOrder.FirstName.Trim() + " " + kitOrder.LastName.Trim()));
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@RequestID", ordNumber);
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@Date:Time", DateTime.Now.ToShortDateString());
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@DeliveryDuration", "5-10 days");
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@Telephone", tenantDetailBO.ContactUsTelephone);
                            emailBO[0].emailEnablementTypeBO.EndUserTemplate = emailBO[0].emailEnablementTypeBO.EndUserTemplate.Replace("@ContactusEmailID", tenantDetailBO.ContactUsEmailID);

                            EmailConfigBO ema = new EmailConfigBO();
                            ema.Body      = emailBO[0].emailEnablementTypeBO.EndUserTemplate;
                            ema.Subject   = "Order Confirmation";
                            ema.ToAddress = kitOrder.Email.Trim();
                            SendEmail(ema);
                        }
                        responce = Request.CreateResponse(HttpStatusCode.OK, "");
                    }
                    catch (Exception exp)
                    {
                        // btnSubmit.Text = "TargetSite :" + exp.TargetSite + "Message :" + exp.Message;
                    }
                }
                else
                {
                    HttpError error = new HttpError("Oops!");
                    responce = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, error);
                }



                //int id= apiDA.SaveOrderKitData(kitOrder);
                //if (id > 0)
                //{
                //    responce= Request.CreateResponse(HttpStatusCode.OK,"");
                //}
                //else
                //{

                //}
            }
            else
            {
                HttpError error = new HttpError("User is not Authenticated");
                responce = Request.CreateErrorResponse(HttpStatusCode.Unauthorized, error);
            }
            return(responce);
        }