protected override bool ProcessCmdKey(ref System.Windows.Forms.Message m, System.Windows.Forms.Keys k) { try { string data = null; // detect the pushing of Enter Key if (k == System.Windows.Forms.Keys.Enter) { if (!string.IsNullOrEmpty(txt_BarCode.Text.Trim())) { lbl_BarCode.Text = txt_BarCode.Text.Trim(); txt_BarCode.Text = ""; if (ConfigurationManager.AppSettings["GATESELECTED"] != null) { data = ConfigurationManager.AppSettings["GATESELECTED"].ToString(); SMSServiceClient sc = new SMSServiceClient(); ServiceReference.BookingDTO BookingData = sc.UpdateGateInformation(Convert.ToInt32(data), Convert.ToInt32(lbl_BarCode.Text.Trim())); if (BookingData != null) { if (!string.IsNullOrEmpty(BookingData.Booking_Truck_RegNo)) lbl_truckno.Text = BookingData.Booking_Truck_RegNo; else lbl_truckno.Text = BookingData.Booking_StandaloneTruck_RegNo; if (data == "1") { if(BookingData.Booking_TruckInTime != null) lbl_Time.Text = (Convert.ToDateTime(BookingData.Booking_TruckInTime.ToString())).ToShortTimeString(); } if (data == "2") { if (BookingData.Booking_TruckMatLiftedTime != null) lbl_Time.Text = (Convert.ToDateTime(BookingData.Booking_TruckMatLiftedTime.ToString())).ToShortTimeString(); } } lbl_TotalCount.Text = sc.GetTruckCountForDateBarcode(DateTime.Now.Date, Convert.ToInt32(data)).ToString().Trim(); } txt_BarCode.Focus(); // return true to stop any further interpretation of this key action return true; } } // if not pushing Enter Key, then process the signal as usual return base.ProcessCmdKey(ref m, k); } catch (Exception ex) { return false; } }
private SMSServiceClient SMSServiceClient(ApplicationConstant.SystemService service) { EndpointAddress endpointAddress = Common.Utilities.getEndpointAddress(service.layGiaTri()); BasicHttpBinding basicHttpBinding = Common.Utilities.getBasicHttpBinding(service.layGiaTri()); SMSServiceClient Client = new SMSServiceClient(basicHttpBinding, endpointAddress); foreach (var operationDescription in Client.Endpoint.Contract.Operations) { DataContractSerializerOperationBehavior dcsob = operationDescription.Behaviors.Find <DataContractSerializerOperationBehavior>(); if (dcsob != null) { dcsob.MaxItemsInObjectGraph = 2147483646; } } return(Client); }
public int DichVu(DatabaseConstant.Action action, ref DICHVU objDichVu, ref List <ClientResponseDetail> listClientResponseDetail) { SMSServiceClient client = null; SMSRequest request = null; SMSResponse response = null; int iret = 1; try { // Kiểm tra kết nối, server, service trước khi request Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.SMSService.layGiaTri()); client = SMSServiceClient(ApplicationConstant.SystemService.SMSService); request = Common.Utilities.PrepareRequest(new SMSRequest()); response = new SMSResponse(); //Khởi tạo request request.Function = DatabaseConstant.Function.SMS_DANG_KY_DVU; request.Action = action; request.objDichVu = objDichVu; // make a call to service client here response = client.SMS(request); //Kiểm tra kết quả trả về Common.Utilities.ValidResponse(request, response); if (response == null) { iret = 0; } else { listClientResponseDetail = Common.Utilities.convertToClientResponseDetail(response); objDichVu = response.objDichVu; if (response.ResponseStatus.Equals(ApplicationConstant.ResponseStatus.THANH_CONG)) { iret = 1; } else { iret = 0; } } } catch (Exception ex) { iret = 0; LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); throw ex; } finally { if (client.State == CommunicationState.Faulted) { client.Abort(); } else { client.Close(); } client = null; request = null; response = null; } return(iret); }
protected void Page_Load(object sender, EventArgs e) { //FileInfo logFile = new FileInfo("c:\\myLogFile.txt"); //var val = Request.QueryString; //using (StreamWriter logStream = logFile.AppendText()) //{ // logStream.Write(val.ToString()); //} //Note: remove all html data from the .aspx page. dont use any html tag in response. //To Print Response use "Response.Write()" method. string strSource = "", strPhoneNumber = "", strMessage = ""; string strKeyword = "", strSubKeyword = "", strAmount = "", strcustCode = ""; //Write all your code in this section //1. Trap all query string variables if ((Request.QueryString["scid"] == null) || (Request.QueryString["pno"] == null) || (Request.QueryString["msg"] == null)) { return; } strSource = Request.QueryString["scid"].ToString(); strPhoneNumber = Request.QueryString["pno"].ToString(); strMessage = Request.QueryString["msg"].ToString(); //Now Split the Message by space to get keyword/subkeywords. //for example you have a keyword "BOOK" and 2 subkeywords under it SUB1 And SUB2. char[] arrSeperator = new char[] { ' ' }; string[] arrKeywords = strMessage.Split(arrSeperator, 4); if (arrKeywords.Length == 1) strKeyword = Convert.ToString(arrKeywords[0]); if (arrKeywords.Length == 2) { strKeyword = Convert.ToString(arrKeywords[0]); strSubKeyword = Convert.ToString(arrKeywords[1]); } if (arrKeywords.Length == 4) { strKeyword = Convert.ToString(arrKeywords[0]); strSubKeyword = Convert.ToString(arrKeywords[2]); strcustCode = Convert.ToString(arrKeywords[1]); strAmount = Convert.ToString(arrKeywords[3]); } //print simple text using "Response.Write" what ever u want in response. if (strKeyword.ToUpper() == "CASH" && strSubKeyword.ToUpper() == "A") //Cash keyword for payment and A for Advance. { strAmount = strAmount.Trim(); //Regex.Replace(strAmount, "[^0-9a-zA-Z]+", ""); double dblAmount; bool isNum = double.TryParse(Convert.ToString(strAmount), out dblAmount); if (isNum) { strAmount = Math.Floor(dblAmount).ToString(); SMSServiceReference.SMSServiceClient sc = new SMSServiceClient(); string msg = sc.RespondPaymentSms(strPhoneNumber, strcustCode.ToUpper(),Convert.ToDecimal(strAmount)); Response.Write(msg); } else { Response.Write(Messages.InvalidAmount); } } else { Response.Write(Messages.CashSMSInvalid); //Invalid Keyword } }
private void Form1_Load(object sender, EventArgs e) { try { pictureBox1.Width = SystemInformation.PrimaryMonitorSize.Width; Panel_BarCode.Location = new Point((SystemInformation.PrimaryMonitorSize.Width / 2 - this.Panel_BarCode.Size.Width / 2), (SystemInformation.PrimaryMonitorSize.Height / 2 - this.Panel_BarCode.Size.Height / 2)); Panel_BarCode.Anchor = AnchorStyles.None; if (ConfigurationManager.AppSettings["GATESELECTED"] != null) { string gateSelected = ConfigurationManager.AppSettings["GATESELECTED"].ToString(); if (gateSelected == "1") { lbl_TotalCountMsg.Text = ConfigurationManager.AppSettings["TRUCKIN"].ToString(); lblpost.Text = ConfigurationManager.AppSettings["STMESSAGEATTRUCKIN"].ToString(); } if (gateSelected == "2") { lbl_TotalCountMsg.Text = ConfigurationManager.AppSettings["TRUCKOUT"].ToString(); lblpost.Text = ConfigurationManager.AppSettings["STMESSAGEATTRUCKOUT"].ToString(); } SMSServiceClient sc = new SMSServiceClient(); lbl_TotalCount.Text = sc.GetTruckCountForDateBarcode(DateTime.Now.Date, Convert.ToInt32(gateSelected)).ToString().Trim(); } txt_BarCode.Focus(); } catch (Exception ex) { txt_BarCode.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { //Note: remove all html data from the .aspx page. dont use any html tag in response. //To Print Response use "Response.Write()" method. string strSource = "", strPhoneNumber = "", strMessage = ""; string strKeyword = "", strSubKeyword = "", strTruckMessage = "", strcustCode = ""; //ShowQuerystringValues(); //Make WCF service call to validate the request //Write all your code in this section //1. Trap all query string variables if ((Request.QueryString["scid"] == null) && (Request.QueryString["scid"] == null) && (Request.QueryString["msg"] == null)) { return; } strSource = Request.QueryString["scid"].ToString(); strPhoneNumber = Request.QueryString["pno"].ToString(); strMessage = Request.QueryString["msg"].ToString(); //Now Split the Message by space to get keyword/subkeywords. //for example you have a keyword "BOOK" and 2 subkeywords under it SUB1 And SUB2. char[] arrSeperator = new char[] { ' ' }; string[] arrKeywords = strMessage.Split(arrSeperator, 4); if (arrKeywords.Length == 1) strKeyword = Convert.ToString(arrKeywords[0]); if (arrKeywords.Length == 2) { strKeyword = Convert.ToString(arrKeywords[0]); strSubKeyword = Convert.ToString(arrKeywords[1]); } if (arrKeywords.Length == 4) { strKeyword = Convert.ToString(arrKeywords[0]); strSubKeyword = Convert.ToString(arrKeywords[2]); strcustCode = Convert.ToString(arrKeywords[1]); strTruckMessage = Convert.ToString(arrKeywords[3]); } //print simple text using "Response.Write" what ever u want in response. if (strKeyword.ToUpper() == "BOOK" && strSubKeyword.ToUpper() == "T") { DateTime midnight = DateTime.Today; DateTime eightam = midnight.AddHours(8); DateTime sixpm = midnight.AddHours(18); if (System.DateTime.Now >= eightam && System.DateTime.Now <= sixpm) { strTruckMessage = Regex.Replace(strTruckMessage, "[^0-9a-zA-Z]+", ""); SMSServiceReference.SMSServiceClient sc = new SMSServiceClient(); string msg = sc.RespondSms(strPhoneNumber, strcustCode.ToUpper(), strTruckMessage.ToUpper()); Response.Write(msg); } else { Response.Write("SMS Booking Sewa subh 8 baje se sham 6 baje tak pratidin uplabdh hai. Apni suvidha anusaar iska labh uthayen aur agle din ke liye booking karen."); } } else { Response.Write("Message in incorrect format, try again"); //Invalid Keyword } }