private void newButton_Click(object sender, EventArgs e)
        {
            cls_kehucishufashengshijian_info item = new cls_kehucishufashengshijian_info();

            item.Input_Date   = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
            item.xinzeng      = "true";
            item.kehuxingming = b_kehuxingming;
            this.bindingSource1.Add(item);
            this.dataGridView1.Refresh();
        }
        private cls_kehucishufashengshijian_info GetSelectedSchedule()
        {
            cls_kehucishufashengshijian_info schedule = null;
            var row = this.dataGridView1.CurrentRow;

            if (row != null)
            {
                schedule = row.DataBoundItem as cls_kehucishufashengshijian_info;
            }
            return(schedule);
        }
        private string sql_yuju(DoWorkEventArgs e, cls_kehucishufashengshijian_info item, string conditions)
        {
            string unsal = conditions;


            if (item.kehuxingming != null)
            {
                conditions += " kehuxingming ='" + item.kehuxingming + "'";
            }
            if (item.shangcichugongshijian != null)
            {
                conditions += " ,shangcichugongshijian ='" + item.shangcichugongshijian + "'";
            }
            if (item.shangcichugongbaojie != null)
            {
                conditions += " ,shangcichugongbaojie ='" + item.shangcichugongbaojie + "'";
            }
            if (item.kehupingjia != null)
            {
                conditions += " ,kehupingjia ='" + item.kehupingjia + "'";
            }
            if (item.beizhu != null)
            {
                conditions += " ,beizhu ='" + item.beizhu + "'";
            }

            if (item.Input_Date != null)
            {
                conditions += " ,Input_Date ='" + item.Input_Date.ToString("yyyy/MM/dd") + "'";
            }
            if (item.xinzeng == "true")
            {
                conditions = "insert into GZCleaning_Status(kehuxingming,shangcichugongshijian,shangcichugongbaojie,kehupingjia,beizhu,Input_Date) values ('" + item.kehuxingming + "','" + item.shangcichugongshijian + "','" + item.shangcichugongbaojie + "','" + item.kehupingjia + "','" + item.beizhu + "','" + item.Input_Date.ToString("yyyy/MM/dd") + "')";
            }
            else if (is_AdminIS == true)
            {
                conditions = "update GZCleaning_Status set  " + conditions + " where status_id = " + item.status_id + " ";
            }
            else if (is_AdminIS == false)
            {
                if (item.shangcichugongshijian != null)
                {
                    unsal += "shangcichugongshijian ='" + item.shangcichugongshijian + "'";
                }
                unsal = "update GZCleaning_Status set  " + unsal + " where status_id = " + item.status_id + " ";

                return(unsal);
                //  e.Result = "[" + item.kehuxingming + "]普通用户无权修改单据,如需修改请联系管理员";
                // throw new Exception("[" + item.kehuxingming + "]普通用户 无权修改单据,如需修改请联系管理员");
            }
            return(conditions);
        }
Пример #4
0
        public List <cls_kehucishufashengshijian_info> findStatus(string findtext)
        {
            SQLiteConnection dbConn = new SQLiteConnection("Data Source=" + dataSource);

            dbConn.Open();
            SQLiteCommand dbCmd = dbConn.CreateCommand();

            dbCmd.CommandText = findtext;

            DbDataReader reader = SQLiteHelper.ExecuteReader("Data Source=" + newsth, dbCmd);
            List <cls_kehucishufashengshijian_info> ClaimReport_Server = new List <cls_kehucishufashengshijian_info>();

            while (reader.Read())
            {
                cls_kehucishufashengshijian_info item = new cls_kehucishufashengshijian_info();

                item.status_id = reader.GetInt32(0);
                if (reader.GetValue(1) != null && Convert.ToString(reader.GetValue(1)) != "")
                {
                    item.kehuxingming = reader.GetString(1);
                }
                if (reader.GetValue(2) != null && Convert.ToString(reader.GetValue(2)) != "")
                {
                    item.shangcichugongshijian = Convert.ToString(reader.GetString(2));
                }
                if (reader.GetValue(3) != null && Convert.ToString(reader.GetValue(3)) != "")
                {
                    item.shangcichugongbaojie = reader.GetString(3);
                }
                if (reader.GetValue(4) != null && Convert.ToString(reader.GetValue(4)) != "")
                {
                    item.kehupingjia = reader.GetString(4);
                }
                if (reader.GetValue(5) != null && Convert.ToString(reader.GetValue(5)) != "")
                {
                    item.beizhu = reader.GetString(5);
                }


                if (reader.GetValue(6) != null && Convert.ToString(reader.GetValue(6)) != "")
                {
                    item.Input_Date = Convert.ToDateTime(reader.GetString(6));
                }



                ClaimReport_Server.Add(item);
            }
            return(ClaimReport_Server);
        }
        private bool dailysaveList(BackgroundWorker worker, DoWorkEventArgs e)
        {
            WorkerArgument arg          = e.Argument as WorkerArgument;
            clsAllnew      BusinessHelp = new clsAllnew();
            bool           success      = true;

            try
            {
                int rowCount = changeindex.Count;
                arg.OrderCount = rowCount;
                int j        = 1;
                int progress = 0;
                #region MyRegion
                for (int ik = 0; ik < changeindex.Count; ik++)
                {
                    j = ik;

                    arg.CurrentIndex = j + 1;
                    progress         = Convert.ToInt16(((j + 1) * 1.0 / rowCount) * 100);

                    int i   = changeindex[ik];
                    var row = dataGridView1.Rows[i];

                    var model = row.DataBoundItem as cls_kehucishufashengshijian_info;

                    cls_kehucishufashengshijian_info item = new cls_kehucishufashengshijian_info();

                    item.kehuxingming = Convert.ToString(dataGridView1.Rows[i].Cells["kehuxingming"].EditedFormattedValue.ToString());

                    item.shangcichugongshijian = Convert.ToString(dataGridView1.Rows[i].Cells["shangcichugongshijian"].EditedFormattedValue.ToString());

                    item.shangcichugongbaojie = Convert.ToString(dataGridView1.Rows[i].Cells["shangcichugongbaojie"].EditedFormattedValue.ToString());

                    item.kehupingjia = Convert.ToString(dataGridView1.Rows[i].Cells["kehupingjia"].EditedFormattedValue.ToString());

                    item.beizhu = Convert.ToString(dataGridView1.Rows[i].Cells["beizhu"].EditedFormattedValue.ToString());

                    item.xinzeng    = Convert.ToString(dataGridView1.Rows[i].Cells["xinzeng"].EditedFormattedValue.ToString());
                    item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                    item.status_id  = model.status_id;

                    #endregion

                    #region MyRegion


                    #region  构造查询条件
                    string conditions = "";
                    conditions = sql_yuju(e, item, conditions);

                    #endregion
                    #endregion

                    int isrun = BusinessHelp.updatecustomer_Server(conditions);
                    if (item.xinzeng == "true" && isrun == 1)
                    {
                        item.xinzeng = "";
                    }

                    if (arg.CurrentIndex % 5 == 0)
                    {
                        backgroundWorker2.ReportProgress(progress, arg);
                    }
                }
                backgroundWorker2.ReportProgress(100, arg);
                e.Result = string.Format("{0} 已保存 !", changeindex.Count);
            }
            catch (Exception ex)
            {
                if (!e.Cancel)
                {
                    e.Result = ex.Message + "";
                }
                success = false;
            }

            return(success);
        }