public DetailOrderView(ref Order_Controller Controller, Order_Model Order) { InitializeComponent(); controller = Controller; order = Order; this.Load += DetailOrderView_Load; }
public DataTable Insertorder_genral_customer(Order_Model model) { DAL.onLocal(); DAL.Open(); DataTable dt = new DataTable(); SqlParameter[] param = new SqlParameter[13]; param[0] = new SqlParameter("@id", SqlDbType.Int); param[0].Value = model.id; param[1] = new SqlParameter("@uuid", SqlDbType.VarChar); param[1].Value = model.uuid; param[2] = new SqlParameter("@customerName", SqlDbType.NVarChar); param[2].Value = model.customerName; param[3] = new SqlParameter("@customerPhone", SqlDbType.NVarChar); param[3].Value = model.customerPhone; param[4] = new SqlParameter("@address", SqlDbType.NVarChar); param[4].Value = model.address; param[5] = new SqlParameter("@note", SqlDbType.NVarChar); param[5].Value = model.note; param[6] = new SqlParameter("@state", SqlDbType.Int); param[6].Value = model.state; param[7] = new SqlParameter("@order_general_deatils_uuid", SqlDbType.VarChar); param[7].Value = model.order_general_deatils_uuid; param[8] = new SqlParameter("@noItem", SqlDbType.Float); param[8].Value = model.noItem; param[9] = new SqlParameter("@amount", SqlDbType.Float); param[9].Value = model.amount; param[10] = new SqlParameter("@date", SqlDbType.DateTime); param[10].Value = model.date; param[11] = new SqlParameter("@user", SqlDbType.Int); param[11].Value = model.user; param[12] = new SqlParameter("@useruuid", SqlDbType.VarChar); param[12].Value = model.useruuid; dt = DAL.SelectData("Insertorder_genral_customer", param); DAL.Close(); return(dt); }
public HttpResponseMessage rejectOrderStatus(Order_Model orderClicked) { TransactionalInformation transaction = new TransactionalInformation(); OrderApiModel orderApiModel = new OrderApiModel(); List <Order_Model> orderList = new List <Order_Model>(); orderDataService.rejectOrderStatus(orderClicked, connectionString, SessionToken, out transaction); if (transaction.ReturnStatus) { return(Request.CreateResponse(HttpStatusCode.OK, "Status Changed")); } return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction)); }
public void orderCustomerInserUpdate(Order_Model order_Model) { DAL2.onOnLine(); MySqlParameter[] param = new MySqlParameter[11]; param[0] = new MySqlParameter("@id", order_Model.id); param[1] = new MySqlParameter("@uuid", order_Model.uuid); param[2] = new MySqlParameter("@customerName", order_Model.customerName); param[3] = new MySqlParameter("@customerPhone", order_Model.customerPhone); param[4] = new MySqlParameter("@address", order_Model.address); param[5] = new MySqlParameter("@note", order_Model.note); param[6] = new MySqlParameter("@order_general_deatils_uuid", order_Model.order_general_deatils_uuid); param[7] = new MySqlParameter("@amount", order_Model.amount); param[8] = new MySqlParameter("@uuidUser", order_Model.useruuid); param[9] = new MySqlParameter("@dateCreated", order_Model.date); param[10] = new MySqlParameter("@state", order_Model.state); DAL2.ExcuCommane("CALL orderCustomerInserUpdate( @id, @uuid,@customerName,@customerPhone, @address, @note, @order_general_deatils_uuid,@amount,@uuidUser,@dateCreated,@state);", param); }
private void btn_AddOrder_Click(object sender, EventArgs e) { Bill_Model BILL_MODEL = new Bill_Model(); Order_Model ORDER_MODEL = new Order_Model(); Drink_Model DRINK_MODEL = new Drink_Model(); string orderID = txt_OrderID.Text; string productID = DRINK_MODEL.GetID_FromName(cbx_Drinks.Text); int quantity = (int)num_Quantity.Value; int sale = (int)num_Sale.Value; BILL_MODEL.AddBill(orderID); ORDER_MODEL.AddOrder(orderID, productID, quantity, sale); MessageBox.Show("ADD ORDER SUCCESSFULLY!"); //obj.loadData_Order(); -> Use it when we want callback MainForm :D this.Close(); this.parentForm.Visible = true; }
public Order_Model rejectOrderStatus(Order_Model orderClicked, string connectionString, string sessionTicket, out TransactionalInformation transaction) { var method = MethodInfo.GetCurrentMethod(); var ipInfo = Util.GetIPInfo(HttpContext.Current.Request); var userSecurityTicket = VerifySessionToken(sessionTicket); transaction = new TransactionalInformation(); try { P_OR_COS_0840a parameter = new P_OR_COS_0840a(); parameter.CaseID = Guid.Parse(orderClicked.case_id); parameter.Order_ID = Guid.Parse(orderClicked.id); parameter.Status_To = 4; parameter.Status_To_Str = "MO4"; var data = cls_Change_Order_Status.Invoke(connectionString, new P_OR_COS_0840() { ParameterArray = new P_OR_COS_0840a[] { parameter } }, userSecurityTicket); Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, parameter)); } catch (Exception ex) { Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, ex)); transaction.ReturnMessage = new List <string>(); string errorMessage = ex.Message; transaction.ReturnStatus = false; transaction.ReturnMessage.Add(errorMessage); transaction.IsAuthenicated = true; transaction.IsException = true; } return(orderClicked); }
public static List <Order_Model> Get_All_Orders(ElasticParameterObject sort_parameter, SessionSecurityTicket securityTicket) { var TenantID = securityTicket.TenantID.ToString(); var serializer = new JsonNetSerializer(); var connection = Elastic_Utils.ElsaticConnection(); string queryS = string.Empty; var order_list = new List <Order_Model>(); if (Elastic_Utils.IfIndexOrTypeExists(TenantID, connection) && Elastic_Utils.IfIndexOrTypeExists(TenantID + "/" + elasticType, connection)) { var sort_by_second_key = ""; var sort_by_third_key = ""; switch (sort_parameter.sort_by) { case "treatment_date": sort_by_second_key = "patient_name"; sort_by_third_key = "patient_birthdate"; break; case "patient_name": sort_by_second_key = "patient_birthdate"; sort_by_third_key = "treatment_date"; break; default: sort_by_second_key = "treatment_date"; sort_by_third_key = "patient_name"; break; } if (string.IsNullOrEmpty(sort_parameter.search_params) && sort_parameter.filter_by.filter_status == null && string.IsNullOrEmpty(sort_parameter.date_from) && string.IsNullOrEmpty(sort_parameter.date_to)) { queryS = QueryBuilderOrders.BuildGetOrderQuery(sort_parameter.start_row_index, 100, sort_parameter.sort_by, sort_parameter.isAsc, sort_by_second_key, sort_by_third_key); } else { bool isOverdueParam = false; sort_parameter.search_params = string.IsNullOrEmpty(sort_parameter.search_params) ? "" : sort_parameter.search_params.ToLower(); if (sort_parameter.filter_by.filter_status != null) { isOverdueParam = sort_parameter.filter_by.filter_status.Contains("overdue"); sort_parameter.filter_by.filter_status = sort_parameter.filter_by.filter_status.Where(i => i != "overdue").ToArray(); } if (!isOverdueParam) { queryS = QueryBuilderOrders.BuildGetSearchOrderQuery(sort_parameter.start_row_index, 100, sort_parameter.sort_by, sort_parameter.isAsc, sort_by_second_key, sort_by_third_key, sort_parameter.search_params, sort_parameter.date_from, sort_parameter.date_to, sort_parameter.filter_by); } else { queryS = QueryBuilderOrders.BuildGetSearchOrderQueryWithOverdue(sort_parameter.start_row_index, 100, sort_parameter.sort_by, sort_parameter.isAsc, sort_by_second_key, sort_by_third_key, sort_parameter.search_params, sort_parameter.date_from, sort_parameter.date_to, sort_parameter.filter_by); } } string searchCommand_Orders = Commands.Search(TenantID, elasticType).Pretty(); string result = connection.Post(searchCommand_Orders, queryS); Dictionary <string, int> PracticeOrdersCount = new Dictionary <string, int>(); var foundResults_Orders = serializer.ToSearchResult <Order_Model>(result); try { foreach (var item in foundResults_Orders.Documents) { Order_Model order_model = new Order_Model(); order_model.case_id = item.case_id; order_model.delivery_time_from = item.delivery_time_from; order_model.delivery_time_string = item.delivery_time_string; order_model.delivery_time_to = item.delivery_time_to; order_model.diagnose = item.diagnose; order_model.drug = item.drug; order_model.id = item.id; order_model.is_orders_drug = item.is_orders_drug; order_model.localization = item.localization; order_model.order_modification_timestamp = item.order_modification_timestamp; order_model.order_modification_timestamp_string = item.order_modification_timestamp_string; order_model.patient_id = item.patient_id; order_model.patient_birthdate = item.patient_birthdate; order_model.patient_birthdate_string = item.patient_birthdate_string; order_model.patient_name = item.patient_name; order_model.practice_id = item.practice_id; order_model.status_drug_order = item.status_drug_order; order_model.treatment_date = item.treatment_date; order_model.treatment_date_day_month = item.treatment_date.ToString("dd.MM.yyyy"); order_model.treatment_date_month_year = item.treatment_date_month_year; order_model.treatment_doctor_name = item.treatment_doctor_name; order_model.treatment_doctor_practice_name = item.treatment_doctor_practice_name; order_model.delivery_date_month = item.treatment_date.ToString("dd.MM."); order_model.pharmacy_id = item.pharmacy_id; order_model.pharmacy_name = item.pharmacy_name; switch (sort_parameter.sort_by) { case "treatment_date": order_model.group_name = order_model.treatment_date.ToString("MMMM yyyy", new System.Globalization.CultureInfo("de", true)).ToUpper(); break; case "patient_name": order_model.group_name = item.patient_name.Substring(0, 1).ToUpper(); break; case "diagnose": order_model.group_name = item.diagnose; break; case "drug": order_model.group_name = item.drug; break; case "localization": order_model.group_name = item.localization; break; case "treatment_doctor_name": order_model.group_name = item.treatment_doctor_practice_name; break; case "status_drug_order": order_model.group_name = item.status_drug_order; break; default: order_model.group_name = item.treatment_date_month_year; break; } order_list.Add(order_model); } } catch (Exception ex) { } } return(order_list); }
public static void Import_Data_From_DB_To_Elastic(DbConnection Connection, DbTransaction Transaction, SessionSecurityTicket securityTicket) { #region add Practices and Doctors to Elastic List <Practice_Doctors_Model> LdoctorPracticeM = new List <Practice_Doctors_Model>(); var dataPractice = cls_Get_All_Practices_from_DB.Invoke(Connection, Transaction, securityTicket).Result; IAccountServiceProvider accountService; var _providerFactory = ProviderFactory.Instance; accountService = _providerFactory.CreateAccountServiceProvider(); if (dataPractice != null) { foreach (var practice in dataPractice) { Practice_Doctors_Model doctorPracticeM = new Practice_Doctors_Model(); bool statusAcc = accountService.GetAccountStatusHistory(securityTicket.TenantID, practice.AccountID).OrderBy(st => st.CreationTimestamp).Reverse().FirstOrDefault().Status == EAccountStatus.BANNED; doctorPracticeM.account_status = statusAcc ? "inaktiv" : "aktiv"; doctorPracticeM.id = practice.PracticeID.ToString(); doctorPracticeM.name = practice.Name; doctorPracticeM.name_untouched = practice.Name; doctorPracticeM.salutation = ""; doctorPracticeM.type = "Practice"; doctorPracticeM.address = practice.Street_Name + " " + practice.Street_Number; doctorPracticeM.zip = practice.ZIP; doctorPracticeM.city = practice.City; if (practice.Contact_Email != null) { doctorPracticeM.email = practice.Contact_Email; } doctorPracticeM.phone = doctorPracticeM.phone; doctorPracticeM.bank_untouched = practice.BankName != null ? practice.BankName : ""; doctorPracticeM.bank = practice.BankName != null ? practice.BankName : ""; if (practice.IBAN != null) { doctorPracticeM.iban = practice.IBAN; } if (practice.BICCode != null) { doctorPracticeM.bic = practice.BICCode; } doctorPracticeM.bsnr_lanr = practice.BSNR; doctorPracticeM.aditional_info = ""; doctorPracticeM.tenantid = securityTicket.TenantID.ToString(); doctorPracticeM.role = practice.IsSurgeryPractice ? "op" : "ac"; DO_GPCN_1133[] dataContract = cls_Get_Practice_Contract_Numbers.Invoke(Connection, Transaction, new P_DO_GPCN_1133() { PracticeID = practice.PracticeID }, securityTicket).Result; doctorPracticeM.contract = dataContract.Count(); LdoctorPracticeM.Add(doctorPracticeM); } } var dataDoc = cls_Get_All_Doctors_from_DB.Invoke(Connection, Transaction, securityTicket).Result; if (dataDoc != null) { foreach (var doctor in dataDoc) { Practice_Doctors_Model doctorPracticeM = new Practice_Doctors_Model(); bool statusAcc = accountService.GetAccountStatusHistory(securityTicket.TenantID, doctor.AccountID).OrderBy(st => st.CreationTimestamp).Reverse().FirstOrDefault().Status == EAccountStatus.BANNED; doctorPracticeM.account_status = statusAcc ? "inaktiv" : "aktiv"; doctorPracticeM.id = doctor.Id.ToString(); var title = string.IsNullOrEmpty(doctor.Title) ? "" : doctor.Title.Trim(); doctorPracticeM.tenantid = securityTicket.TenantID.ToString(); doctorPracticeM.name = title + " " + doctor.LastName + " " + doctor.FirstName; doctorPracticeM.name_untouched = doctor.LastName + " " + doctor.FirstName; doctorPracticeM.bsnr_lanr = doctor.Lanr.ToString(); doctorPracticeM.salutation = title; doctorPracticeM.type = "Doctor"; doctorPracticeM.bank = string.IsNullOrEmpty(doctor.BankName) ? "" : doctor.BankName; doctorPracticeM.bank_untouched = string.IsNullOrEmpty(doctor.BankName) ? "" : doctor.BankName; doctorPracticeM.phone = doctor.Phone; doctorPracticeM.email = string.IsNullOrEmpty(doctor.Email) ? "" : doctor.Email; doctorPracticeM.iban = string.IsNullOrEmpty(doctor.IBAN) ? "" : doctor.IBAN; doctorPracticeM.bic = string.IsNullOrEmpty(doctor.BICCode) ? "" : doctor.BICCode; var practice = dataPractice.Where(pr => pr.PracticeID == doctor.Practice_ID).SingleOrDefault(); doctorPracticeM.practice_for_doctor_id = practice.PracticeID.ToString(); doctorPracticeM.practice_name_for_doctor = practice.Name; doctorPracticeM.address = practice.Street_Name + " " + practice.Street_Number; doctorPracticeM.zip = practice.ZIP; doctorPracticeM.city = practice.City; doctorPracticeM.role = practice.IsSurgeryPractice ? "op" : "ac"; if (doctor.BankAccountID == practice.BankAccountID) { doctorPracticeM.bank_id = practice.BankAccountID.ToString(); doctorPracticeM.bank_info_inherited = true; doctorPracticeM.bank_untouched = practice.BankName != null ? practice.BankName : ""; doctorPracticeM.bank = practice.BankName != null ? practice.BankName : ""; if (practice.IBAN != null) { doctorPracticeM.iban = practice.IBAN; } if (practice.BICCode != null) { doctorPracticeM.bic = practice.BICCode; } } else { doctorPracticeM.bank_id = doctor.BankAccountID.ToString(); doctorPracticeM.bank_info_inherited = false; doctorPracticeM.bank_untouched = doctor.BankName != null ? doctor.BankName : ""; doctorPracticeM.bank = doctor.BankName != null ? doctor.BankName : ""; if (doctor.IBAN != null) { doctorPracticeM.iban = doctor.IBAN; } if (doctor.BICCode != null) { doctorPracticeM.bic = doctor.BICCode; } } var docContracts = cls_Get_Doctor_Contract_Numbers.Invoke(Connection, Transaction, new P_DO_CDCD_1505() { DoctorID = doctor.Id }, securityTicket).Result; doctorPracticeM.contract = docContracts.Count(); LdoctorPracticeM.Add(doctorPracticeM); } } //first delete Tenant index try { Add_Practice_Doctors_to_Elastic.Delete_index_on_Elastic(securityTicket.TenantID.ToString()); // Add_Practice_Doctors_to_Elastic.Delete_index_on_Elastic(securityTicket.TenantID.ToString() + "/" + "user"); Console.Write("Type Doctors_Practices deleted"); } catch { Console.Write("Type Doctors_Practices do not exsists"); } //import items to Elastic if (dataDoc != null | dataPractice != null) { Add_Practice_Doctors_to_Elastic.Import_Practice_Data_to_ElasticDB(LdoctorPracticeM, securityTicket.TenantID.ToString()); } #endregion #region add Patients to Elastic var dataPatients = cls_Get_All_Patients_from_DB.Invoke(Connection, Transaction, securityTicket).Result; if (dataPatients != null) { try { // Add_Practice_Doctors_to_Elastic.Delete_index_on_Elastic(securityTicket.TenantID.ToString() + "/" + "patient"); Console.Write("Type Patients deleted"); } catch { Console.Write("Type Patients do not exsists"); } foreach (var patient in dataPatients) { Patient_Model patientModel = new Patient_Model(); var HIPLIst = cls_Get_All_HIPs.Invoke(Connection, Transaction, securityTicket).Result.ToList(); string HIP = HIPLIst.Where(i => i.id == patient.HIPID).Single().name; IFormatProvider culture = new System.Globalization.CultureInfo("de", true); patientModel.birthday = DateTime.Parse(patient.BirthDate.ToString("dd.MM.yyyy"), culture, System.Globalization.DateTimeStyles.AssumeLocal); patientModel.birthday_string = patient.BirthDate.ToString("dd.MM.yyyy"); patientModel.name = patient.LastName + ", " + patient.FirstName; patientModel.health_insurance_provider = HIP; patientModel.name_with_birthdate = patient.FirstName + " " + patient.LastName + " (" + patient.BirthDate.ToString("dd.MM.yyyy") + ")"; patientModel.id = patient.Id.ToString(); patientModel.insurance_id = patient.HipNumber; patientModel.insurance_status = patient.InsuranceStatus; patientModel.practice_id = patient.PracticeID.ToString(); if (patient.Gender == 0) { patientModel.sex = "M"; } else if (patient.Gender == 1) { patientModel.sex = "W"; } else if (patient.Gender == 2) { patientModel.sex = "o.A."; } //Add patient participation consent if (patient.ValidFrom != DateTime.MinValue) { patientModel.participation_consent_from = patient.ValidFrom; patientModel.has_participation_consent = true; } if (patient.ValidThrough != DateTime.MinValue) { patientModel.participation_consent_to = patient.ValidThrough; } Add_New_Patient.Import_Patients_to_ElasticDB(patientModel, securityTicket.TenantID.ToString()); } Console.Write("Patients imported to elastic"); } #endregion #region Add Cases to Elastic List <Case_Model> cases = new List <Case_Model>(); List <Order_Model> OrderModelL = new List <Order_Model>(); var dataCases = cls_Get_All_Cases_from_DB.Invoke(Connection, Transaction, securityTicket).Result; if (dataCases != null) { foreach (var Case in dataCases) { if (Case.case_status == null) { var diagnose_details = cls_Get_Diagnose_Details_for_DiagnoseID.Invoke(Connection, Transaction, new P_CAS_GDDfDID_1357() { DiagnoseID = Case.diagnose_id }, securityTicket).Result; var drug_details = cls_Get_Drug_Details_for_DrugID.Invoke(Connection, Transaction, new P_CAS_GDDfDID_1614() { DrugID = Case.drug_id }, securityTicket).Result; Case_Model case_model_elastic = new Case_Model(); case_model_elastic.diagnose = diagnose_details != null ? diagnose_details.diagnose_name + " (" + diagnose_details.catalog_display_name + ": " + diagnose_details.diagnose_icd_10 + ")" : ""; case_model_elastic.drug = drug_details != null ? drug_details.drug_name : ""; case_model_elastic.id = Case.case_id.ToString(); case_model_elastic.localization = Case.localization; case_model_elastic.status_drug_order = Case.order_id != Guid.Empty ? "MO1" : ""; case_model_elastic.status_treatment = Case.diagnose_id != Guid.Empty ? "OP1" : ""; case_model_elastic.patient_name = Case.patient_id != Guid.Empty ? Case.Patient_LastName + ", " + Case.Patient_FirstName : ""; case_model_elastic.patient_birthdate_string = Case.Patient_BirthDate.ToString("dd.MM.yyyy"); case_model_elastic.patient_birthdate = Case.Patient_BirthDate; if (Case.is_aftercare_practice) { case_model_elastic.aftercare_name = Case.aftercare_practice_display_name; } else if (Case.is_aftercare_doctor) { case_model_elastic.aftercare_name = Case.aftercare_doctor_display_name; } else { case_model_elastic.aftercare_name = "-"; } var aftercare_doctor_details = cls_Get_Doctor_Details_for_DoctorID.Invoke(Connection, Transaction, new P_DO_GDDfDID_0823() { DoctorID = Case.ac_doctor_id }, securityTicket).Result.SingleOrDefault(); if (aftercare_doctor_details != null) { case_model_elastic.aftercare_name = aftercare_doctor_details.title + " " + aftercare_doctor_details.last_name + " " + aftercare_doctor_details.first_name; case_model_elastic.aftercare_doctors_practice_name = aftercare_doctor_details.practice; } case_model_elastic.is_aftercare_doctor = Case.is_aftercare_doctor; case_model_elastic.treatment_date_day_month = Case.treatment_date.ToString("dd.MM."); case_model_elastic.treatment_date_month_year = Case.treatment_date.ToString("MMMM yyyy", new System.Globalization.CultureInfo("de", true)); var treatment_doctor_details = cls_Get_Doctor_Details_for_DoctorID.Invoke(Connection, Transaction, new P_DO_GDDfDID_0823() { DoctorID = Case.treatment_doctor_id }, securityTicket).Result.SingleOrDefault(); case_model_elastic.treatment_doctor_name = treatment_doctor_details != null ? treatment_doctor_details.title + " " + treatment_doctor_details.last_name + " " + treatment_doctor_details.first_name : "-"; case_model_elastic.practice_id = Case.practice_id.ToString(); case_model_elastic.order_modification_timestamp = Case.order_modification_timestamp; case_model_elastic.order_modification_timestamp_string = Case.order_modification_timestamp.ToString("dd.MM.yyyy"); case_model_elastic.delivery_time_from = Case.order_id != Guid.Empty ? Case.alternative_delivery_date_from : Case.treatment_date; case_model_elastic.delivery_time_to = Case.order_id != Guid.Empty ? Case.alternative_delivery_date_to : Case.treatment_date.AddHours(23).AddMinutes(59); case_model_elastic.delivery_time_string = case_model_elastic.delivery_time_from.ToString("HH:mm") + " - " + case_model_elastic.delivery_time_to.ToString("HH:mm"); Order_Model orderM = new Order_Model(); if (Case.order_id != Guid.Empty) { case_model_elastic.is_orders_drug = true; OR_GOSfCID_0858[] OrderCtatusList = cls_Get_Order_Status_for_CaseID.Invoke(Connection, Transaction, new P_OR_GOSfCID_0858() { CaseID = Case.case_id }, securityTicket).Result; OrderCtatusList = OrderCtatusList.OrderBy(tmp => tmp.StatusCreated).Reverse().ToArray(); case_model_elastic.status_drug_order = OrderCtatusList.Count() > 0 ? "MO" + OrderCtatusList.First().StatusCode : "MO1"; if (OrderCtatusList.Count() > 1) { case_model_elastic.previous_status_drug_order = "MO" + OrderCtatusList[1].StatusCode; } else { case_model_elastic.previous_status_drug_order = "MO1"; } orderM.status_drug_order = OrderCtatusList.Count() > 0 ? "MO" + OrderCtatusList.First().StatusCode : "MO1"; } else { case_model_elastic.is_orders_drug = false; } cases.Add(case_model_elastic); if (Case.order_id != Guid.Empty) { orderM.case_id = case_model_elastic.id; orderM.id = Case.OrderHeaderID.ToString(); orderM.delivery_time_from = Case.alternative_delivery_date_from != null ? Case.alternative_delivery_date_from : Case.treatment_date; orderM.delivery_time_to = Case.alternative_delivery_date_from != null ? Case.alternative_delivery_date_to : Case.treatment_date.AddHours(23).AddMinutes(59); orderM.delivery_time_string = case_model_elastic.delivery_time_from.ToString("HH:mm") + " - " + case_model_elastic.delivery_time_to.ToString("HH:mm"); orderM.practice_id = Case.practice_id.ToString(); orderM.order_modification_timestamp = DateTime.Now; orderM.order_modification_timestamp_string = DateTime.Now.ToString("dd.MM.yyyy"); orderM.is_orders_drug = true; orderM.treatment_date = Case.treatment_date; orderM.treatment_date_day_month = Case.treatment_date.ToString("dd.MM."); orderM.treatment_date_month_year = Case.treatment_date.ToString("MMMM yyyy", new System.Globalization.CultureInfo("de", true)); orderM.treatment_doctor_name = treatment_doctor_details != null ? treatment_doctor_details.title + " " + treatment_doctor_details.last_name + " " + treatment_doctor_details.first_name : "-"; orderM.treatment_doctor_practice_name = treatment_doctor_details != null ? treatment_doctor_details.practice : "-"; orderM.localization = Case.diagnose_id != Guid.Empty ? Case.localization : "-"; orderM.diagnose = diagnose_details != null ? diagnose_details.diagnose_name + " (" + diagnose_details.catalog_display_name + ": " + diagnose_details.diagnose_icd_10 + ")" : "-"; orderM.drug = drug_details != null ? drug_details.drug_name : ""; orderM.patient_name = Case.patient_id != Guid.Empty ? Case.Patient_LastName + ", " + Case.Patient_FirstName : ""; orderM.patient_birthdate_string = Case.Patient_BirthDate.ToString("dd.MM.yyyy"); orderM.patient_birthdate = Case.Patient_BirthDate; OrderModelL.Add(orderM); } } } try { Add_Practice_Doctors_to_Elastic.Delete_index_on_Elastic(securityTicket.TenantID.ToString() + "/" + "case"); Console.Write("Type Case deleted"); } catch { Console.Write("Type do not exsists"); } Add_New_Case.Import_Case_Data_to_ElasticDB(cases, securityTicket.TenantID.ToString()); Add_New_Order.Import_Order_Data_to_ElasticDB(OrderModelL, securityTicket.TenantID.ToString()); Console.Write("Cases and Orders imported to Elastic"); } #endregion }
public ActionResult checkout(Order_Model obj) { List <Item> cart = (List <Item>)Session["cart"]; decimal totalSum = 0; StringBuilder body = new StringBuilder(); try { if (cart.Count() != 0) { body.AppendLine("Order:"); body.AppendLine("<table font-family= arial, sans-serif, border-collapse = collapse, width= 100% >"); body.AppendLine("<tr>"); body.AppendLine("<td><b>Article</b></td>"); body.AppendLine("<td><b>Title</b></td>"); body.AppendLine("<td><b>Size</b></td>"); body.AppendLine("<td><b>Color</b></td>"); body.AppendLine("<td><b>Quantity</b></td>"); body.AppendLine("<td><b>Price</b></td>"); body.AppendLine("</tr>"); foreach (Item items in (List <Item>)Session["cart"]) { totalSum = totalSum + Convert.ToDecimal(items.Products.p_price * items.Quantity); body.AppendLine("<tr>"); body.AppendLine("<td>"); body.AppendLine(items.Products.p_article_no); body.AppendLine("</td>"); body.AppendLine("<td>"); body.AppendLine(items.Products.p_title); body.AppendLine("</td>"); body.AppendLine("<td>"); body.AppendLine("size"); body.AppendLine("</td>"); body.AppendLine("<td>"); body.AppendLine("color"); body.AppendLine("</td>"); body.AppendLine("<td>"); body.AppendLine("quantity"); body.AppendLine("</td>"); body.AppendLine("<td>"); body.AppendLine(items.Products.p_price.ToString()); body.AppendLine("</td>"); } body.AppendLine("</table>"); } } catch (Exception) { } try { if (ModelState.IsValid) { WebMail.Send( "*****@*****.**", "New Order", body + "<br/><br/>" + "<b>" + "Total Amount: " + "</b>" + totalSum + "<br/><br/>" + "<b>" + "Information of Buyer:" + "</b>" + "<br/>" + "Name: " + obj.First_Name + " " + obj.Last_Name + "<br/>" + "Email: " + obj.Email + "<br/>" + "Phone: " + obj.Phone + "<br/>" + "City: " + obj.City + "<br/>" + "Address: " + obj.Address + "<br/><br/>", null, null, null, true, null, null, null, null, null, obj.Email ); return(RedirectToAction("Index", "Home")); } } catch (Exception) { ViewBag.Error = "Problems sending Email!"; } return(View()); }
public bool SearchOrder(ref List <Order_Model> lstResult, DateTime beginTime, DateTime endTime, string User, short IsCompleted) { bool result = false; try { string condition = string.Empty; condition += "`ischeckoutcompleted` = " + true.ToString() + " "; if (IsCompleted != 1) { condition += "and `isOrderCompleted` = '" + IsCompleted + "' "; } condition += "and `createDate` >= '" + beginTime.ToString("yyyyMMddHHmmss") + "' "; condition += "and `createDate` <= '" + endTime.ToString("yyyyMMddHHmmss") + "' "; if (User != string.Empty) { condition += "and (`username` like '%" + User.Replace("\'", "\\\'") + "' "; condition += " or `username` like '" + User.Replace("\'", "\\\'") + "%' "; condition += " or `username` like '%" + User.Replace("\'", "\\\'") + "%') "; } DataTable dt; if ((dt = DBHandler.selectDataBase(ref conn, "`order`", "*", condition)) != null) { lstResult = new List <Order_Model>(); for (int i = 0; i < dt.Rows.Count; i++) { Order_Model item = new Order_Model() { order_id = (long)dt.Rows[i]["order_id"], guid = (string)dt.Rows[i]["guid"], product_id = (long)dt.Rows[i]["product_id"], style_id = (long)dt.Rows[i]["style_id"], color_id = (long)dt.Rows[i]["color_id"], size_id = (long)dt.Rows[i]["size_id"], quantity = (int)dt.Rows[i]["quantity"], username = (string)dt.Rows[i]["username"], ischeckoutcompleted = (bool)dt.Rows[i]["ischeckoutcompleted"], createDate = (DateTime)dt.Rows[i]["createDate"], email = (string)dt.Rows[i]["email"], firstname = (string)dt.Rows[i]["firstname"], lastname = (string)dt.Rows[i]["lastname"], street_address = (string)dt.Rows[i]["street_address"], apt_suite_other = (string)dt.Rows[i]["apt_suite_other"], city = (string)dt.Rows[i]["city"], postal_code = (string)dt.Rows[i]["postal_code"], country_id = (int)dt.Rows[i]["country_id"], phone_number = (string)dt.Rows[i]["phone_number"], province = (string)dt.Rows[i]["province"], isOrderCompleted = (short)dt.Rows[i]["isOrderCompleted"] }; lstResult.Add(item); } result = true; } } catch (Exception ex) { LogFile.writeLog(LogFile.DIR, "Exception" + LogFile.getTimeStringNow() + ".txt", LogFile.Filemode.GHIDE, ex.Message); } return(result); }