Ejemplo n.º 1
0
        //将重置好了的信息添加到重置申请表,状态为已审批
        public void addcz()
        {
            addsqlwhere = " where 1=1";

            addsqlwhere += " and CarInfo_Name = '" + gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString() + "'";

            string    sql   = "select CarInfo_ID,CarInfo_Name,SmallTicket_ID,SmallTicket_Serialnumber,SmallTicket_SortNumber,ICCard_ID,ICCard_Value from View_CarState " + addsqlwhere + "";
            DataTable table = LinQBaseDao.Query(sql).Tables[0];

            sortReset sr = new sortReset();

            //组装对象
            sr.sortReset_CarInfo_ID   = Convert.ToInt32(table.Rows[0]["CarInfo_ID"].ToString());
            sr.sortReset_CarInfo_Name = table.Rows[0]["CarInfo_Name"].ToString();
            sr.sortReset_QTongxing    = txtqian.Text.Trim();
            sr.sortReset_HTongxing    = cbohou.Text.Trim();
            //判断是有小票的还是是有IC卡的车辆信息

            if (!string.IsNullOrEmpty(table.Rows[0]["SmallTicket_Serialnumber"].ToString()))
            {
                sr.sortReset_SmallTicket_Serialnumber = table.Rows[0]["SmallTicket_Serialnumber"].ToString();
            }
            else if (!string.IsNullOrEmpty(table.Rows[0]["ICCard_Value"].ToString()) && !string.IsNullOrEmpty(table.Rows[0]["ICCard_ID"].ToString()))
            {
                sr.sortReset_SmallTicket_ICCard_ID    = Convert.ToInt32(table.Rows[0]["ICCard_ID"].ToString());
                sr.sortReset_SmallTicket_ICCard_Value = table.Rows[0]["ICCard_Value"].ToString();
            }

            sr.sortReset_SmallTicket_SortNumber        = table.Rows[0]["SmallTicket_SortNumber"].ToString();
            sr.sortReset_SortNumberInfo_SmallTicket_ID = Convert.ToInt32(table.Rows[0]["SmallTicket_ID"].ToString());
            sr.sortReset_ShenQingTime = CommonalityEntity.GetServersTime();
            sr.sortReset_SortTime     = CommonalityEntity.GetServersTime();
            sr.sortReset_ShenQingRen  = CommonalityEntity.USERNAME;
            sr.sortReset_Sortren      = CommonalityEntity.USERNAME;
            sr.sortReset_Sortjg       = 1;//0为未处理,1为已处理
            sr.sortReset_Remark       = txtRemark.Text.Trim();
            if (LinQBaseDao.InsertOne <sortReset>(new DCCarManagementDataContext(), sr))
            {
                CommonalityEntity.WriteLogData("修改", "特权重置了车牌为" + table.Rows[0]["CarInfo_Name"].ToString() + "的车辆通行状态。", CommonalityEntity.USERNAME);
            }
        }
Ejemplo n.º 2
0
        //申请重置
        private void btnshenqing_Click(object sender, EventArgs e)
        {
            addsqlwhere = " where 1=1";
            if (txtRemark.Text.Trim() == "")
            {
                MessageBox.Show("重置原因不能为空。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count > 1)
            {
                MessageBox.Show("每次只能对一辆车进行重置申请。", "提示");
                return;
            }
            else if (gridevewSortReset.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择一个车辆信息进行重置申请。", "提示");
                return;
            }
            if (txtqian.Text.ToString() == cbohou.SelectedText.ToString())
            {
                MessageBox.Show("重置后状态不能与重置前是相同的状态。", "提示");
                return;
            }
            if (string.IsNullOrEmpty(cbohou.Text))
            {
                MessageBox.Show("请选择重置后状态。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count == 1)
            {
                string sqlcc = "select sortReset_SortNumberInfo_SmallTicket_ID from sortReset where sortReset_CarInfo_ID = " + gridevewSortReset.SelectedRows[0].Cells["CarInfo_ID"].Value.ToString() + " and sortReset_Sortjg = 0";
                int    count = LinQBaseDao.Query(sqlcc).Tables[0].Rows.Count;
                if (count >= 1)
                {
                    MessageBox.Show("该车辆已有一条未审批的记录,不能重复添加。", "提示");
                }
                else if (count == 0)
                {
                    addsqlwhere += " and CarInfo_Name = '" + gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString() + "'";

                    string    sql   = "select CarInfo_ID,CarInfo_Name,SmallTicket_ID,SmallTicket_Serialnumber,SmallTicket_SortNumber,ICCard_ID,ICCard_Value from View_CarState " + addsqlwhere + "";
                    DataTable table = LinQBaseDao.Query(sql).Tables[0];

                    sortReset sr = new sortReset();
                    sr.sortReset_CarInfo_ID   = Convert.ToInt32(table.Rows[0]["CarInfo_ID"].ToString());
                    sr.sortReset_CarInfo_Name = table.Rows[0]["CarInfo_Name"].ToString();
                    sr.sortReset_QTongxing    = txtqian.Text.Trim();
                    sr.sortReset_HTongxing    = cbohou.Text.Trim();

                    //判断是有小票的还是是有IC卡的车辆信息
                    if (table.Rows[0]["ICCard_Value"].ToString() == "" && table.Rows[0]["ICCard_ID"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_Serialnumber = table.Rows[0]["SmallTicket_Serialnumber"].ToString();
                    }
                    else if (table.Rows[0]["SmallTicket_Serialnumber"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_ICCard_ID    = Convert.ToInt32(table.Rows[0]["ICCard_ID"].ToString());
                        sr.sortReset_SmallTicket_ICCard_Value = table.Rows[0]["ICCard_Value"].ToString();
                    }

                    sr.sortReset_SmallTicket_SortNumber        = table.Rows[0]["SmallTicket_SortNumber"].ToString();
                    sr.sortReset_SortNumberInfo_SmallTicket_ID = Convert.ToInt32(table.Rows[0]["SmallTicket_ID"].ToString());
                    sr.sortReset_ShenQingTime = CommonalityEntity.GetServersTime();
                    sr.sortReset_ShenQingRen  = CommonalityEntity.USERNAME;
                    sr.sortReset_Sortjg       = 0;
                    sr.sortReset_Remark       = txtRemark.Text.Trim();

                    if (LinQBaseDao.InsertOne <sortReset>(new DCCarManagementDataContext(), sr))
                    {
                        MessageBox.Show("申请成功!!!", "提示");

                        txtqian.Text         = "";
                        txtchepai.Text       = "";
                        txtmengang.Text      = "";
                        txtpaiduihao.Text    = "";
                        txtxiaopiao.Text     = "";
                        cbohou.SelectedIndex = 0;
                        cbohou.Enabled       = false;
                        btnshenqing.Enabled  = false;
                    }
                    else
                    {
                        CommonalityEntity.WriteLogData("增加", "申请了车牌为" + table.Rows[0]["CarInfo_Name"].ToString() + "的状态重置申请。", CommonalityEntity.USERNAME);
                        MessageBox.Show("申请失败!!!", "提示");
                        txtchepai.Text    = "";
                        txtmengang.Text   = "";
                        txtpaiduihao.Text = "";
                        txtxiaopiao.Text  = "";
                    }
                }
            }
        }