protected void btnOK_Click(object sender, EventArgs e) { //if (hidFORM_ID.Value.Trim() == "") //{ // litWarn.Text = "请选择对应的表单"; //AgileFrame.Core.ScriptHelper.Alert(Page, "请选择对应的表单!"); // return; //} //else { // TF_F_COLUMN ccc = new TF_F_COLUMN(); // ccc.FORM_ID = int.Parse(hidFORM_ID.Value); // if (BLLTable<TF_F_COLUMN>.Count(ccc) <= 0) // { // litWarn.Text = "您选择的表单还未配置栏目字段!请先配置栏目。"; //AgileFrame.Core.ScriptHelper.Alert(Page, "请选择对应的表单!"); // return; // } //} try { APP_DEVICELIST valObj = new APP_DEVICELIST(); valObj.STATUS = 1; APP_DEVICELIST conObj = new APP_DEVICELIST(); conObj.USER_ID = Convert.ToInt32(txtSTAFFID.Value); BLLTable <APP_DEVICELIST> .Update(valObj, conObj); } catch (Exception ex) { litWarn.Text = ex.Message; } }
protected void btnOK_Click(object sender, EventArgs e) { //if (hidFORM_ID.Value.Trim() == "") //{ // litWarn.Text = "��ѡ���Ӧ�ı��"; //AgileFrame.Core.ScriptHelper.Alert(Page, "��ѡ���Ӧ�ı����"); // return; //} //else { // TF_F_COLUMN ccc = new TF_F_COLUMN(); // ccc.FORM_ID = int.Parse(hidFORM_ID.Value); // if (BLLTable<TF_F_COLUMN>.Count(ccc) <= 0) // { // litWarn.Text = "��ѡ��ı����δ������Ŀ�ֶΣ�����������Ŀ��"; //AgileFrame.Core.ScriptHelper.Alert(Page, "��ѡ���Ӧ�ı����"); // return; // } //} try { APP_DEVICELIST valObj = new APP_DEVICELIST(); valObj.STATUS = 1; APP_DEVICELIST conObj = new APP_DEVICELIST(); conObj.USER_ID = Convert.ToInt32(txtSTAFFID.Value); BLLTable<APP_DEVICELIST>.Update(valObj, conObj); } catch (Exception ex) { litWarn.Text = ex.Message; } }
public void sendByTime() { switch (pushtype) { case "0": sendMessageToAndroid(message, null); sendMessageToIOS(message, null, valObj.ID); break;//全部 case "1": sendMessageToAndroid(message, null); break;//Android case "2": sendMessageToIOS(message, null, valObj.ID); break;//IOS case "3": APP_DEVICELIST conf = new APP_DEVICELIST(); conf.USER_ID = Convert.ToInt32(staffid); conf.STATUS = 0; List<APP_DEVICELIST> deviceList = BLLTable<APP_DEVICELIST>.Select( new APP_DEVICELIST(),conf); foreach (APP_DEVICELIST device in deviceList) { if (device.KIND == 0) { sendMessageToIOS(message, device.TOKEN_ID, valObj.ID); } else { sendMessageToAndroid(message, staffid); } } break;//指定 } }
public void sendByTime() { switch (pushtype) { case "0": sendMessageToAndroid(message, null); sendMessageToIOS(message, null, valObj.ID); break; //全部 case "1": sendMessageToAndroid(message, null); break; //Android case "2": sendMessageToIOS(message, null, valObj.ID); break; //IOS case "3": APP_DEVICELIST conf = new APP_DEVICELIST(); conf.USER_ID = Convert.ToInt32(staffid); conf.STATUS = 0; List <APP_DEVICELIST> deviceList = BLLTable <APP_DEVICELIST> .Select(new APP_DEVICELIST(), conf); foreach (APP_DEVICELIST device in deviceList) { if (device.KIND == 0) { sendMessageToIOS(message, device.TOKEN_ID, valObj.ID); } else { sendMessageToAndroid(message, staffid); } } break; //指定 } }
public void sendMessageToIOS(string message, string tokenid, int messageid) { bool sandbox = true; string p12File = "test.p12"; string p12FilePassword = "******"; string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File); NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1); service.SendRetries = 5; //5 retries before generating notificationfailed event service.ReconnectDelay = 5000; //5 seconds if (!string.IsNullOrEmpty(tokenid)) { Notification alertNotification = new Notification(tokenid); alertNotification.Payload.Alert.Body = "您有一条来自服务器的新消息!"; alertNotification.Payload.Sound = "default"; alertNotification.Payload.Badge = 1; alertNotification.Payload.AddCustom("kind", "1"); alertNotification.Payload.AddCustom("messageId", messageid); alertNotification.Payload.AddCustom("fromId", -1); //alertNotification.Payload.AddCustom(txtName3.Value, txtVaule3.Value); //Queue the notification to be sent if (service.QueueNotification(alertNotification)) { } else { } } else { APP_DEVICELIST conf = new APP_DEVICELIST(); conf.KIND = 0; conf.STATUS = 0; List <APP_DEVICELIST> devicelist = BLLTable <APP_DEVICELIST> .Select(new APP_DEVICELIST(), conf); foreach (APP_DEVICELIST device in devicelist) { Notification alertNotification = new Notification(device.TOKEN_ID); alertNotification.Payload.Alert.Body = "您有一条来自服务器的新消息!"; alertNotification.Payload.Sound = "default"; alertNotification.Payload.Badge = 1; alertNotification.Payload.AddCustom("kind", "1"); alertNotification.Payload.AddCustom("messageId", Convert.ToString(messageid)); alertNotification.Payload.AddCustom("fromId", -1); //alertNotification.Payload.AddCustom(txtName3.Value, txtVaule3.Value); //Queue the notification to be sent if (service.QueueNotification(alertNotification)) { } else { } } } service.Close(); service.Dispose(); }
public void sendMessageToIOS(string message,string tokenid,int messageid) { bool sandbox = true; string p12File = "test.p12"; string p12FilePassword = "******"; string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File); NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1); service.SendRetries = 5; //5 retries before generating notificationfailed event service.ReconnectDelay = 5000; //5 seconds if (!string.IsNullOrEmpty(tokenid)) { Notification alertNotification = new Notification(tokenid); alertNotification.Payload.Alert.Body = "您有一条来自服务器的新消息!"; alertNotification.Payload.Sound = "default"; alertNotification.Payload.Badge = 1; alertNotification.Payload.AddCustom("kind", "1"); alertNotification.Payload.AddCustom("messageId", messageid); alertNotification.Payload.AddCustom("fromId", -1); //alertNotification.Payload.AddCustom(txtName3.Value, txtVaule3.Value); //Queue the notification to be sent if (service.QueueNotification(alertNotification)) { } else { } } else { APP_DEVICELIST conf = new APP_DEVICELIST(); conf.KIND = 0; conf.STATUS = 0; List<APP_DEVICELIST> devicelist = BLLTable<APP_DEVICELIST>.Select(new APP_DEVICELIST(),conf); foreach (APP_DEVICELIST device in devicelist) { Notification alertNotification = new Notification(device.TOKEN_ID); alertNotification.Payload.Alert.Body = "您有一条来自服务器的新消息!"; alertNotification.Payload.Sound = "default"; alertNotification.Payload.Badge = 1; alertNotification.Payload.AddCustom("kind", "1"); alertNotification.Payload.AddCustom("messageId", Convert.ToString(messageid)); alertNotification.Payload.AddCustom("fromId", -1); //alertNotification.Payload.AddCustom(txtName3.Value, txtVaule3.Value); //Queue the notification to be sent if (service.QueueNotification(alertNotification)) { } else { } } } service.Close(); service.Dispose(); }