コード例 #1
0
ファイル: OrderKitDA.cs プロジェクト: RR250205/test
        public OrderKitBO SaveOrderKitManual(OrderKitBO KitOrderManual)
        {
            OrderKitBO ordKitBO = new OrderKitBO();
            DataSet    set      = new DataSet();

            try
            {
                using (SqlConnection con = new SqlConnection(_connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand("sspSaveOrderKitManual", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.Add(new SqlParameter("@FirstName", KitOrderManual.FirstName));
                        cmd.Parameters.Add(new SqlParameter("@LastName", KitOrderManual.LastName));
                        cmd.Parameters.Add(new SqlParameter("@RequesterType", KitOrderManual.RequesterType));
                        cmd.Parameters.Add(new SqlParameter("@OrgName", KitOrderManual.OrgName));
                        cmd.Parameters.Add(new SqlParameter("@Address", KitOrderManual.Address));
                        cmd.Parameters.Add(new SqlParameter("@City", KitOrderManual.City));
                        cmd.Parameters.Add(new SqlParameter("@State", KitOrderManual.State));
                        cmd.Parameters.Add(new SqlParameter("@Country", KitOrderManual.Country));
                        cmd.Parameters.Add(new SqlParameter("@Zip", KitOrderManual.Zip));
                        cmd.Parameters.Add(new SqlParameter("@KitType", KitOrderManual.KitType));
                        cmd.Parameters.Add(new SqlParameter("@Telephone", KitOrderManual.Phone));
                        cmd.Parameters.Add(new SqlParameter("@Email", KitOrderManual.Email));
                        cmd.Parameters.Add(new SqlParameter("@NoOfKits", KitOrderManual.NoOfKits));
                        cmd.Parameters.Add(new SqlParameter("@Message", KitOrderManual.Message));
                        cmd.Parameters.Add(new SqlParameter("@TenantID", KitOrderManual.TenantID));
                        cmd.Parameters.Add(new SqlParameter("@orderKitStatus", KitOrderManual.Status));
                        cmd.Parameters.Add(new SqlParameter("@OrderKitID", KitOrderManual.KitOrderID));

                        con.Open();

                        //SqlDataReader readData = cmd.ExecuteReader();
                        //if (readData.HasRows)
                        //{
                        //    readData.Read();
                        //    Number = readData[0] == DBNull.Value ? 0 : Convert.ToInt32(readData[0]);
                        //}
                        SqlDataAdapter ad = new SqlDataAdapter(cmd);
                        ad.Fill(set);
                        if (set.Tables.Count > 1)
                        {
                            ordKitBO.KitOrderID    = set.Tables[1].Rows[0].ItemArray[0] == DBNull.Value ? 0 : Convert.ToInt32(set.Tables[1].Rows[0].ItemArray[0]);
                            ordKitBO.RequestNumber = set.Tables[0].Rows[0].ItemArray[0] == DBNull.Value ? string.Empty : Convert.ToString(set.Tables[0].Rows[0].ItemArray[0]);
                        }
                        con.Close();
                    }
                }
            }
            catch (Exception exx)
            {
            }
            return(ordKitBO);
        }
コード例 #2
0
ファイル: OrderKitDA.cs プロジェクト: RR250205/test
        public OrderKitBO GetOrderKitDetails(string orderKitID)
        {
            OrderKitBO orderKitBO = new OrderKitBO();

            try
            {
                using (SqlConnection con = new SqlConnection(_connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand("select * from stblOrderKit where OrderKitID=@OrderKitID", con))
                    {
                        cmd.Parameters.Add(new SqlParameter("@OrderKitID", orderKitID));
                        con.Open();
                        SqlDataReader reader = cmd.ExecuteReader();

                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                orderKitBO.FirstName        = reader["FirstName"] == DBNull.Value ? String.Empty : Convert.ToString(reader["FirstName"]);
                                orderKitBO.LastName         = reader["LastName"] == DBNull.Value ? String.Empty : Convert.ToString(reader["LastName"]);
                                orderKitBO.OrgName          = (reader["OrgName"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["OrgName"]);
                                orderKitBO.RequesterType    = (reader["RequesterType"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["RequesterType"]);
                                orderKitBO.Address          = (reader["Address"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Address"]);
                                orderKitBO.City             = (reader["City"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["City"]);
                                orderKitBO.State            = (reader["State"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["State"]);
                                orderKitBO.Country          = (reader["Country"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Country"]);
                                orderKitBO.Zip              = (reader["Zip"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Zip"]);
                                orderKitBO.Phone            = (reader["Phone"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Phone"]);
                                orderKitBO.Email            = (reader["Email"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Email"]);
                                orderKitBO.NoOfKits         = (reader["NoOfKits"]) == DBNull.Value ? 0 : Convert.ToInt32(reader["NoOfKits"]);
                                orderKitBO.Message          = (reader["Message"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Message"]);
                                orderKitBO.Status           = (reader["Status"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["Status"]);
                                orderKitBO.KitOrderID       = (reader["OrderKitID"]) == DBNull.Value ? 0 : Convert.ToInt32(reader["OrderKitID"]);
                                orderKitBO.TenantID         = (reader["TenantID"]) == DBNull.Value ? 0 : Convert.ToInt32(reader["TenantID"]);
                                orderKitBO.Date             = (reader["OrderedOn"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["OrderedOn"]);
                                orderKitBO.RequestNumber    = (reader["OrderNumber"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["OrderNumber"]);
                                orderKitBO.KitType          = (reader["KitType"]) == DBNull.Value ? String.Empty : Convert.ToString(reader["KitType"]);
                                orderKitBO.TrackNumber      = (reader["TrackNumber"]) == DBNull.Value ? string.Empty : Convert.ToString(reader["TrackNumber"]);
                                orderKitBO.DeleveryOn       = (reader["DeleveryOn"]) == DBNull.Value ? string.Empty : Convert.ToString(reader["DeleveryOn"]);
                                orderKitBO.LabelGeneratedOn = (reader["LabelGeneratedOn"]) == DBNull.Value ? string.Empty : Convert.ToString(reader["LabelGeneratedOn"]);
                                orderKitBO.PickedUpOn       = (reader["PickedUpOn"]) == DBNull.Value ? string.Empty : Convert.ToString(reader["PickedUpOn"]);
                            }
                        }
                        con.Close();
                        reader.Close();
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(orderKitBO);
        }
コード例 #3
0
ファイル: OrderKitDA.cs プロジェクト: RR250205/test
 public void updateCourierInfoToOrderKit_Pickuped(OrderKitBO obo)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         using (SqlCommand cmd = new SqlCommand("update stblOrderKit set PickedUpOn=@PickedUpOn, OrderKitStatus='Kit Dispatched' where OrderKitID=@OrderKitID", con))
         {
             cmd.Parameters.Add(new SqlParameter("@PickedUpOn", obo.PickedUpOn));
             cmd.Parameters.Add(new SqlParameter("@OrderKitID", obo.KitOrderID));
             cmd.CommandType = CommandType.Text;
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
         }
     }
 }
コード例 #4
0
ファイル: OrderKitDA.cs プロジェクト: RR250205/test
 public void updateCourierInfoToOrderKit(OrderKitBO obo)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         using (SqlCommand cmd = new SqlCommand("update stblOrderKit set  TrackNumber=@TrackNumber, DeleveryOn=@DeleveryOn, LabelGeneratedOn=@LabelGeneratedOn , OrderKitStatus='Label Generated' where OrderKitID=@OrderKitID", con))
         {
             cmd.Parameters.Add(new SqlParameter("@TrackNumber", obo.TrackNumber));
             cmd.Parameters.Add(new SqlParameter("@DeleveryOn", obo.DeleveryOn));
             cmd.Parameters.Add(new SqlParameter("@LabelGeneratedOn", obo.LabelGeneratedOn));
             // cmd.Parameters.Add(new SqlParameter("@PickedUpOn", obo.PickedUpOn));
             cmd.Parameters.Add(new SqlParameter("@OrderKitID", obo.KitOrderID));
             cmd.CommandType = CommandType.Text;
             con.Open();
             cmd.ExecuteNonQuery();
             con.Close();
         }
     }
 }
コード例 #5
0
        public OrderKitBO MakeShipment()
        {
            OrderKitBO obo = new OrderKitBO();
            // Set this to true to process a COD shipment and print a COD return Label
            bool isCodShipment             = false;
            ProcessShipmentRequest request = CreateShipmentRequest(isCodShipment);
            // LogXML(request, typeof(ProcessShipmentRequest));
            //
            ShipService service = new ShipService();

            if (usePropertyFile())
            {
                service.Url = getProperty("endpoint");
            }
            //
            try
            {
                // Call the ship web service passing in a ProcessShipmentRequest and returning a ProcessShipmentReply
                ProcessShipmentReply reply = service.processShipment(request);
                //
                if ((reply.HighestSeverity != NotificationSeverityType.ERROR) && (reply.HighestSeverity != NotificationSeverityType.FAILURE))
                {
                    // ShowShipmentReply(isCodShipment, reply);
                    //LogXML(reply, typeof(ProcessShipmentReply));
                    foreach (CompletedPackageDetail packageDetail in reply.CompletedShipmentDetail.CompletedPackageDetails)
                    {
                        if (packageDetail.TrackingIds != null)
                        {
                            for (int i = 0; i < packageDetail.TrackingIds.Length; i++)
                            {
                                obo.TrackNumber      = packageDetail.TrackingIds[i].TrackingNumber;
                                obo.LabelGeneratedOn = DateTime.Now.ToShortDateString();
                            }
                        }
                        ShowShipmentLabels(isCodShipment, reply.CompletedShipmentDetail, packageDetail);
                    }
                    if (reply.CompletedShipmentDetail.OperationalDetail.DeliveryDateSpecified)
                    {
                        obo.DeleveryOn = reply.CompletedShipmentDetail.OperationalDetail.DeliveryDate.ToShortDateString();
                    }
                }
                List <CourierNotificationBO> notifi = new List <CourierNotificationBO>();
                for (int i = 0; i < reply.Notifications.Length; i++)
                {
                    Notification notification = reply.Notifications[i];
                    notifi.Add(new CourierNotificationBO()
                    {
                        cNotification = notification.Message,
                    });
                    //obo.oNotifications.Add(new CourierNotificationBO()
                    //{
                    //    cNotification = notification.Message,
                    //    //cNotification = "Notification no. " + i + " Severity: " + notification.Severity + " Code: " + notification.Code + " Message: " + notification.Message,
                    //});

                    /* Console.WriteLine("Notification no. {0}", i);
                     * Console.WriteLine(" Severity: {0}", notification.Severity);
                     * Console.WriteLine(" Code: {0}", notification.Code);
                     * Console.WriteLine(" Message: {0}", notification.Message);
                     * Console.WriteLine(" Source: {0}", notification.Source);*/
                }
                obo.oNotifications = notifi;
                //ShowNotifications(reply);
            }
            catch (SoapException e)
            {
                obo.Exception = e.Detail.InnerText;
                //Console.WriteLine(e.Detail.InnerText);
            }
            catch (Exception e)
            {
                //obo.Exception = e.Message;
                obo.Exception = "Exception: " + "Target Site: " + e.TargetSite + "message : " + e.Message;

                //Console.WriteLine(e.Message);
            }
            //  Console.WriteLine("Press any key to quit !");
            //  Console.ReadKey();
            return(obo);
        }
コード例 #6
0
ファイル: KitorderController.cs プロジェクト: RR250205/test
        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);
        }