Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0)
                {
                    FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000);
                    return;
                }
                ConstantType entity = CGridHelper.GetCurrentData <ConstantType>(dgv);

                ConstantApi constantApi = new ConstantApi();
                var         resp        = constantApi.DeleteConstantType(entity.ID);
                //string sql = "DELETE ConstantType WHERE ID = @ID";
                //Hashtable hashtable = new Hashtable();
                //hashtable.Add("ID", entity.ID);
                //if (_mssqlHelper.ExcuteNonQuery(sql, hashtable) > 0)
                //{
                if (resp.Code == 1)
                {
                    FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000);
                    CGridHelper.DeleteRow(dgv);
                }
                else
                {
                    FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000);
                }
            }
            catch (Exception ex)
            {
                FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000);
            }
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0)
                {
                    FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000);
                    return;
                }
                Menus entity = CGridHelper.GetCurrentData <Menus>(dgv);

                MenuApi constantApi = new MenuApi();
                var     resp        = constantApi.DeleteMenu(entity.Id);
                if (resp.Code == 1)
                {
                    FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000);
                    CGridHelper.DeleteRow(dgv);
                }
                else
                {
                    FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000);
                }
            }
            catch (Exception ex)
            {
                FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000);
            }
        }
Beispiel #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            List <Role> list = null;

            ControlHelper.ThreadRunExt(AppHelper.MainForm, () =>
            {
                var succ = true;
                var msg  = "";
                try
                {
                    ResponseModel responseModel = new ResponseModel();
                    RbacApi rbac  = new RbacApi();
                    responseModel = rbac.GetRoles();



                    if (responseModel.Code == 1)
                    {
                        if (responseModel.DataCount > 0)
                        {
                            list = JsonConvert.DeserializeObject <List <Role> >(responseModel?.Data?.ToString());
                            ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                            {
                                if (list != null)
                                {
                                    CGridHelper.ClearGrid(dgv);
                                    CGridHelper.FillGrid <Role>(dgv, list);
                                }
                            });
                        }
                        else
                        {
                            succ = false;
                            msg  = "查询数据为空!";
                        }
                    }
                    else
                    {
                        succ = false;
                        msg  = responseModel?.Message;
                    }
                }
                catch (Exception ex)
                {
                    succ = false;
                    msg  = ex.Message;
                }
                if (!succ)
                {
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error);
                    });
                }
            }, null, AppHelper.MainForm, true, "正在查询……", 200);
        }
Beispiel #4
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0)
         {
             FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000);
             return;
         }
         Menus       entity = CGridHelper.GetCurrentData <Menus>(dgv);
         MenuOptForm form   = new MenuOptForm(entity);
         form.ShowDialog();
     }
     catch (Exception ex)
     {
         FrmTips.ShowTipsError(AppHelper.MainForm, "修改异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000);
     }
 }
Beispiel #5
0
        //获取列表
        public void ReadCarList()
        {
            // ZJJYXM HPHM ZZL jclsh jyzt jyxm sbkkh ycybh
            string sql = "SELECT TOP 100 YTH_CLLSXXB.ZJJYXM,YTH_CLJCXXB.HPHM,YTH_CLJCXXB.ZZL," +
                         "YTH_CLLSXXB.jclsh,YTH_CLLSXXB.jyzt,YTH_CLLSXXB.jyxm,YTH_CLLSXXB.sbkkh,YTH_CLLSXXB.ycybh FROM " +
                         "YTH_CLJCXXB INNER JOIN YTH_CLLSXXB " +
                         "ON YTH_CLJCXXB.jclsh = YTH_CLLSXXB.jclsh WHERE 1=1 " +
                         " AND (YTH_CLLSXXB.jyzt <= 7 or YTH_CLLSXXB.zjzt = 1)" +
                         " AND mtcbj = 1 AND   YTH_CLLSXXB.ZJJYXM IS NOT NULL AND YTH_CLLSXXB.ZJJYXM <> '' ";

            if (!string.IsNullOrEmpty(txtSearchHphm.Text.Trim()))
            {
                sql += $" AND YTH_CLJCXXB.HPHM LIKE '%{txtSearchHphm.Text.Trim()}%'";
            }
            sql += " ORDER BY YTH_CLLSXXB.dlrq";
            List <VehilceQueue> vehilceQueues = MssqlHelper.GetInstance().QueryList <VehilceQueue>(sql, null).ToList();

            CGridHelper.FillGrid <VehilceQueue>(dgvVehicle, vehilceQueues);
        }
Beispiel #6
0
        //开始测试
        private void StartTest()
        {
            VehilceQueue vehilceQueue = CGridHelper.GetCurrentData <VehilceQueue>(dgvVehicle);

            if (vehilceQueue != null)
            {
                TaskQueue.ClearQueue();
                TaskQueue.WaitResult = false;
                string    sql           = $"SELECT * FROM YTH_V_CLLSXXB WHERE JCLSH = @JCLSH ";
                Hashtable paraHashtable = new Hashtable();
                paraHashtable.Add("JCLSH", vehilceQueue.jclsh);
                YTH_V_CLLSXXB cllsxxb = MssqlHelper.GetInstance().Query <YTH_V_CLLSXXB>(sql, paraHashtable);
                TaskQueue.JCLSH = vehilceQueue.jclsh;
                if (cllsxxb.zjjyxm.ToLower().Contains("hw"))
                {
                    SelectMethodForm selectForm = new SelectMethodForm();
                    GlobalVar.IsShowForm = true;
                    selectForm.ShowDialog(this);
                    GlobalVar.IsShowForm = false;
                    if (selectForm.DialogResult == DialogResult.OK)
                    {
                        string jyxm = selectForm.GetMethod();
                        if ("15".Equals(jyxm))
                        {
                            GlobalVar.IsShowForm = true;
                            AlterStandardForm alterStandardForm = new AlterStandardForm();
                            alterStandardForm.ShowDialog(this);
                            GlobalVar.IsShowForm = false;
                        }
                        if (!string.IsNullOrEmpty(jyxm))
                        {
                            TaskQueue.AddTask(CreateTxt(cllsxxb, jyxm));
                        }
                    }
                }

                if (cllsxxb.zjjyxm.ToLower().Contains("nj") || cllsxxb.zjjyxm.ToLower().Contains("yh") || cllsxxb.zjjyxm.ToLower().Contains("s1"))
                {
                    TaskQueue.AddTask(CreateTxt(cllsxxb, "40", cllsxxb.zjjyxm.ToLower().Contains("nj"), cllsxxb.zjjyxm.ToLower().Contains("yh"), cllsxxb.zjjyxm.ToLower().Contains("s1")));
                }
            }
        }
Beispiel #7
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0)
         {
             FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000);
             return;
         }
         ConstantType   entity = CGridHelper.GetCurrentData <ConstantType>(dgv);
         DicTypeOptForm form   = new DicTypeOptForm(entity);
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             btnSearch_Click(null, null);
         }
     }
     catch (Exception ex)
     {
         FrmTips.ShowTipsError(AppHelper.MainForm, "修改异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000);
     }
 }
Beispiel #8
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            List <ConstantDefine> list = null;

            ControlHelper.ThreadRunExt(this, () =>
            {
                try
                {
                    Hashtable hashtable = null;
                    string sql          = "SELECT  * FROM NetTypeDefine WHERE 1=1 ";

                    if (!string.IsNullOrEmpty(txtSeachPlateNo.Text.Trim()))
                    {
                        hashtable = new Hashtable();
                        hashtable.Add("DefineType", "%" + txtSeachPlateNo.Text.Trim() + "%");
                        sql += " AND DefineType like @DefineType";
                    }
                    list = _mssqlHelper.QueryList <ConstantDefine>(sql, hashtable).ToList();
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        if (list != null)
                        {
                            CGridHelper.ClearGrid(dgv);
                            CGridHelper.FillGrid <ConstantDefine>(dgv, list);
                        }
                    });
                }
                catch (Exception ex)
                {
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        FrmTips.ShowTips(AppHelper.MainForm, ex.Message, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error);
                    });
                }
            }, null, AppHelper.MainForm, true, "正在查询……", 200);
        }
Beispiel #9
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            List <ConstantType> list = null;

            ControlHelper.ThreadRunExt(AppHelper.MainForm, () =>
            {
                var succ = true;
                var msg  = "";
                try
                {
                    ResponseModel responseModel = new ResponseModel();
                    ConstantApi constantApi     = new ConstantApi();
                    responseModel = constantApi.GetConstantTypes();

                    //Hashtable hashtable = null;
                    //string sql = "SELECT  * FROM ConstantType WHERE 1=1 ";

                    //if (!string.IsNullOrEmpty(txtSeach.Text.Trim()))
                    //{
                    //    hashtable = new Hashtable();
                    //    hashtable.Add("TypeName", "%" + txtSeach.Text.Trim() + "%");
                    //    sql += " AND TypeName like @DefineType";
                    //}
                    //list = _mssqlHelper.QueryList<ConstantType>(sql, hashtable).ToList();


                    if (responseModel.Code == 1)
                    {
                        if (responseModel.DataCount > 0)
                        {
                            list = JsonConvert.DeserializeObject <List <ConstantType> >(responseModel?.Data?.ToString());
                            ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                            {
                                if (list != null)
                                {
                                    CGridHelper.ClearGrid(dgv);
                                    CGridHelper.FillGrid <ConstantType>(dgv, list);
                                }
                            });
                        }
                        else
                        {
                            succ = false;
                            msg  = "查询数据为空!";
                        }
                        //FrmTips.ShowTips(AppHelper.MainForm, "查询数据为空!", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Success);
                    }
                    else
                    {
                        succ = false;
                        msg  = responseModel?.Message;
                    }
                    // FrmTips.ShowTips(AppHelper.MainForm,responseModel?.Message, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error);
                }
                catch (Exception ex)
                {
                    succ = false;
                    msg  = ex.Message;
                }
                if (!succ)
                {
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error);
                    });
                }
            }, null, AppHelper.MainForm, true, "正在查询……", 200);
        }