Beispiel #1
0
 private void frmRoute_Activated(object sender, EventArgs e)
 {
     frmMain.Instance.ShowStatusText("正在数据....");
     routeSetting = RouteSettingHelper.SelectByID(1);
     if (routeSetting.IsNull() || routeSetting.RouteID.IsNull()) return;
     txtPassword.Text = routeSetting.RPassword;
     txtRouteIP.Text = routeSetting.RouteIP;
     txtUserName.Text = routeSetting.UserName;
     txtRouteConnect.Text = routeSetting.RouteConnect;
     txtRouteDisConnect.Text = routeSetting.RouteDisConnect;
     if (routeSetting.RouteMethod == "GET") rdoGET.Checked = true;
     if (routeSetting.RouteMethod == "POST") rdoPOST.Checked = true;
     frmMain.Instance.ShowStatusText("数据加载完成!");
 }
Beispiel #2
0
        private void mnuEdit_Click(object sender, EventArgs e)
        {
            RouteSetting info = new RouteSetting();
            info.UserName = txtUserName.Text;
            info.RPassword = txtPassword.Text;
            info.RouteIP = txtRouteIP.Text;
            info.RouteConnect = txtRouteConnect.Text;
            info.RouteDisConnect = txtRouteDisConnect.Text;
            info.RouteMethod = rdoGET.Checked ? "GET" : "POST";
            if (routeSetting.IsNull() || routeSetting.RouteID.IsNull()) {
                info.RouteID = 1;
                RouteSettingHelper.Insert(info);
            } else {
                info.RouteID = routeSetting.RouteID;
                RouteSettingHelper.Update(info);
            }
            RouteSettingHelper.ClearCacheAll();

            MessageBox.Show("保存数据成功!", " 系统提示");
            this.Close();
        }
Beispiel #3
0
 public RouteController()
 {
     routeInfo = RouteSettingHelper.SelectByID(1);
 }
 /// <summary>
 /// ·����Ӽ�¼
 /// </summary>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <param name="delCache">��ӳɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>����Ƿ�ɹ�</returns>
 public static bool Insert(RouteSetting routeSetting, string dbkey = "", string[] delCache = null)
 {
     int obj = new SQL().Database(dbkey).Insert(RouteSetting._)
         .ValueP(RouteSetting._RouteID, routeSetting.RouteID)
         .ValueP(RouteSetting._RouteIP, routeSetting.RouteIP)
         .ValueP(RouteSetting._UserName, routeSetting.UserName)
         .ValueP(RouteSetting._RPassword, routeSetting.RPassword)
         .ValueP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
         .ValueP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
         .ValueP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
         .ToExec();
     if (delCache.IsNull()) return obj == 1;
     Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
     return obj == 1;
 }
 /// <summary>
 /// ·���޸Ķ�����¼
 /// </summary>
 /// <param name="routeIDList">·�ɱ���б���á�,���ŷָ�</param>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool UpdateByIDList(IEnumerable<int> routeIDList,  RouteSetting routeSetting, string dbkey)
 {
     return UpdateByIDList(routeIDList,  routeSetting, dbkey, null, null);
 }
 /// <summary>
 /// ·���޸Ķ�����¼
 /// </summary>
 /// <param name="routeIDList">·�ɱ���б���á�,���ŷָ�</param>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <param name="where">�޸�ʱ����������ͳһ��ǰ��Ҫ�����ӷ���and��or�ȵȣ�</param>
 /// <param name="delCache">�޸ijɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool UpdateByIDList(IEnumerable<int> routeIDList,  RouteSetting routeSetting, string dbkey = "", Where where = null, string[] delCache = null)
 {
     int value = new SQL().Database(dbkey).Update(RouteSetting._)
         .SetP(RouteSetting._RouteIP, routeSetting.RouteIP)
         .SetP(RouteSetting._UserName, routeSetting.UserName)
         .SetP(RouteSetting._RPassword, routeSetting.RPassword)
         .SetP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
         .SetP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
         .SetP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
         .Where(new Where()
             .And(RouteSetting._RouteID, "(" + routeIDList .Join(",") + ")", Operator.In)
         ).Where(where).ToExec();
     if (value <= 0) return false;
     if (delCache.IsNull()) return true;
     Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
     return true;
 }
 /// <summary>
 /// ·���޸ļ�¼
 /// </summary>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool Update(RouteSetting routeSetting, string dbkey)
 {
     return Update(routeSetting, dbkey, null, null);
 }
 /// <summary>
 /// ·���޸ļ�¼
 /// </summary>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <param name="where">�޸�ʱ����������ͳһ��ǰ��Ҫ�����ӷ���and��or�ȵȣ�</param>
 /// <param name="delCache">�޸ijɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool Update(RouteSetting routeSetting, string dbkey = "", Where where = null, string[] delCache = null)
 {
     if (routeSetting.RouteID.IsNull()) return false;
     int value = new SQL().Database(dbkey).Update(RouteSetting._)
         .SetP(RouteSetting._RouteIP, routeSetting.RouteIP)
         .SetP(RouteSetting._UserName, routeSetting.UserName)
         .SetP(RouteSetting._RPassword, routeSetting.RPassword)
         .SetP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
         .SetP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
         .SetP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
         .Where(new Where()
             .AndP(RouteSetting._RouteID, routeSetting.RouteID, Operator.Equal, true)
         ).Where(where).ToExec();
     if (value <= 0) return false;
     if (delCache.IsNull()) return true;
     Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
     return true;
 }
 /// <summary>
 /// ·����Ӽ�¼
 /// </summary>
 /// <param name="routeSetting">·��ʵ����</param>
 /// <returns>����Ƿ�ɹ�</returns>
 public static bool Insert(RouteSetting routeSetting, string dbkey)
 {
     return Insert(routeSetting, dbkey, null);
 }