コード例 #1
0
 //删除
 private void DataGridViewDelete(DataGridViewSummary dbView)
 {
     try
     {
         int k = dbView.SelectedRows.Count;
         if (MessageBox.Show("确实要删除这" + Convert.ToString(k) + "项吗?", "系统提示") == DialogResult.No)
         {
         }
         else
         {
             if (k != dbView.Rows.Count - 2)
             {
                 for (int i = k; i >= 1; i--)
                 {
                     dbView.Rows.RemoveAt(dbView.SelectedRows[i - 1].Index);
                 }
             }
             else
             {
                 dbView.Rows.Clear();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #2
0
 //粘贴
 private void DataGridViewCellPaste(DataGridViewSummary dbView)
 {
     try
     {
         dtSource.Rows.Clear();
         // 获取剪切板的内容,并按行分割
         string pasteText = Clipboard.GetText();
         if (string.IsNullOrEmpty(pasteText))
         {
             return;
         }
         string[] lines = pasteText.Split(new char[] { '\n' });
         foreach (string line in lines)
         {
             if (string.IsNullOrEmpty(line.Trim()))
             {
                 continue;
             }
             string[] vals = line.Split('\t');
             if (string.IsNullOrEmpty(vals[1]))
             {
                 continue;
             }
             DataRow ndr = dtSource.NewRow();
             ndr.ItemArray = vals;
             dtSource.Rows.Add(ndr);
         }
         dbView.DataSource = dtSource;
     }
     catch (Exception ex)
     {
     }
 }
コード例 #3
0
 //复制
 private void DataGridViewCellCopy(DataGridViewSummary dbView)
 {
     try
     {
         if (dbView.GetCellCount(DataGridViewElementStates.Selected) > 0)
         {
             try
             {
                 Clipboard.SetDataObject(dbView.GetClipboardContent());
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
        public void delete_fjrb(DataGridViewSummary dg_fjrb, Model.Qskyd_fjrb M_Qskyd_fjrb, BLL.Qskyd_fjrb B_Qskyd_fjrb)
        {
            common_file.common_app.get_czsj();
            if (dg_fjrb.Rows.Count > 0 && dg_fjrb.Rows[0].Cells["id"].Value != null && dg_fjrb.Rows[0].Cells["id"].Value.ToString() != string.Empty)
            {
                if (dg_fjrb.CurrentRow.Index >= 0 || dg_fjrb.Rows.Count > 0)
                {
                    if (common_file.common_app.message_box_show_select(common_file.common_app.message_title, "你真的要删除所选的记录吗?") == true)
                    {
                        string id = dg_fjrb.Rows[dg_fjrb.CurrentRow.Index].Cells["id"].Value.ToString();
                        M_Qskyd_fjrb = B_Qskyd_fjrb.GetModel(int.Parse(id));
                        if (M_Qskyd_fjrb != null)
                        {
                            if (M_Qskyd_fjrb.fjbh == "" && M_Qskyd_fjrb.fjrb == "")
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,当前记录只能修改!");
                                return;
                            }
                            if (M_Qskyd_fjrb.fjbh != "" && M_Qskyd_fjrb.fjrb != "")
                            {
                                common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,排房记录不能在此删除!若要删除,请到主单去操作!");
                                return;
                            }
                            if (M_Qskyd_fjrb.fjbh == "" && M_Qskyd_fjrb.fjrb != "")
                            {
                                BLL.Common B_Common = new Hotel_app.BLL.Common();
                                DataSet    ds_temp  = B_Common.GetList("select * from Qskyd_fjrb", "lsbh='" + M_Qskyd_fjrb.lsbh + "'");
                                if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 1)
                                {
                                    common_file.common_app.get_czsj();
                                    string   url  = common_file.common_app.service_url + "Qyddj/Qyddj_app.asmx";
                                    object[] args = new object[26];
                                    args[0]  = id;
                                    args[1]  = common_file.common_app.yydh;
                                    args[2]  = common_file.common_app.qymc;
                                    args[3]  = M_Qskyd_fjrb.lsbh;
                                    args[4]  = M_Qskyd_fjrb.krxm;
                                    args[5]  = M_Qskyd_fjrb.sktt;
                                    args[6]  = M_Qskyd_fjrb.yddj;
                                    args[7]  = M_Qskyd_fjrb.fjrb;
                                    args[8]  = M_Qskyd_fjrb.fjbh;
                                    args[9]  = M_Qskyd_fjrb.ddsj;
                                    args[10] = M_Qskyd_fjrb.lksj;
                                    args[11] = M_Qskyd_fjrb.lzfs;
                                    args[12] = M_Qskyd_fjrb.shqh;
                                    args[13] = M_Qskyd_fjrb.fjjg;
                                    args[14] = M_Qskyd_fjrb.sjfjjg;
                                    args[15] = M_Qskyd_fjrb.yh;
                                    args[16] = M_Qskyd_fjrb.yhbl;
                                    args[17] = M_Qskyd_fjrb.bz;
                                    args[18] = common_file.common_app.czy;
                                    args[19] = DateTime.Now;
                                    args[20] = common_file.common_app.chinese_delete;
                                    args[21] = M_Qskyd_fjrb.yddj;//有三种状态,一种预订、一种登记、一种预订转登记
                                    args[22] = common_file.common_app.get_delete;
                                    args[23] = common_file.common_app.xxzs;
                                    args[24] = "";
                                    args[25] = decimal.Parse("0");

                                    Hotel_app.Server.Qyddj.Qskyd_fjrb_add_edit_delete Qskyd_fjrb_add_edit_delete_services = new Hotel_app.Server.Qyddj.Qskyd_fjrb_add_edit_delete();
                                    string result = Qskyd_fjrb_add_edit_delete_services.Qskyd_fjrb_add_edit_delete_app(args[0].ToString(), args[1].ToString(), args[2].ToString(), args[3].ToString(), args[4].ToString(), args[5].ToString(), args[6].ToString(), args[7].ToString(), args[8].ToString(), DateTime.Parse(args[9].ToString()), DateTime.Parse(args[10].ToString()), Decimal.Parse(args[11].ToString()), args[12].ToString(), Decimal.Parse(args[13].ToString()),
                                                                                                                       Decimal.Parse(args[14].ToString()), args[15].ToString(), Decimal.Parse(args[16].ToString()), args[17].ToString(), args[18].ToString(), DateTime.Parse(args[19].ToString()), args[20].ToString(), args[21].ToString(), args[22].ToString(), args[23].ToString(), args[24].ToString(), Decimal.Parse(args[25].ToString()));
                                    // object result = Hotel_app.我的替换DynamicWebServiceCall.InvokeWebService(url, "Qskyd_fjrb_add_edit_delete_app", args);
                                    if (result == common_file.common_app.get_suc)
                                    {
                                        dg_fjrb.Rows.Remove(dg_fjrb.CurrentRow);
                                        common_file.common_app.Message_box_show(common_file.common_app.message_title, "删除成功!");
                                    }
                                    else
                                    {
                                        common_file.common_app.Message_box_show(common_file.common_app.message_title, "操作失败!");
                                    }
                                }
                                else
                                {
                                    common_file.common_app.Message_box_show(common_file.common_app.message_title, "对不起,单条记录不能在此删除!若要删除,请到主单去操作!");
                                }
                            }
                        }
                        else
                        {
                            common_file.common_app.Message_box_show(common_file.common_app.message_title, "你好,找不到相应的记录!");
                        }
                    }
                }

                else
                {
                    //提示
                    common_file.common_app.Message_box_show(common_file.common_app.message_title, "你好,你没有选择任何信息!");
                }
            }
            Cursor.Current = Cursors.Default;
        }
コード例 #5
0
 public static void searchButtion_Click(int tempCount, DataTable dt, string tableName, ref int CurrentPage, int PageSize, ref int PageCount, Label l_totalPage, Label l_currentPage, DataGridViewSummary dg_infoSource, string GetSelCond, TabControl tabControl1)
 {
     common_file.common_app.get_czsj();
     tempCount = -1;
     dt        = DbHelperSQL.CommonPagination(tableName, tableName + ".id", tableName + ".id", CurrentPage, PageSize, "*", GetSelCond, "", ref tempCount);
     if ((tempCount % PageSize) == 0)
     {
         PageCount = tempCount / PageSize;
     }
     else
     {
         PageCount = tempCount / PageSize + 1;
     }
     l_totalPage.Text   = PageCount.ToString();
     l_currentPage.Text = CurrentPage.ToString();
     dg_infoSource.AutoGenerateColumns = false;
     dg_infoSource.DataSource          = dt;
     tabControl1.SelectedIndex         = 0;
     tabControl1.TabPages[0].Focus();
     Cursor.Current = Cursors.Default;
 }
コード例 #6
0
        /// <summary>
        /// 分页代码
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="PageSize"></param>
        /// <param name="CurrentPage"></param>
        /// <param name="l_totalPage"></param>
        /// <param name="l_currentPage"></param>
        /// <param name="dt"></param>
        /// <param name="tableName"></param>
        /// <param name="dg_infoSource"></param>
        /// <param name="GetSelCond"></param>
        public static void linkButtion_Click(object operation_sender, int PageSize, int PageCount, ref int CurrentPage, Label l_totalPage, Label l_currentPage, DataTable dt, string tableName, DataGridViewSummary dg_infoSource, string GetSelCond)
        {
            int tempCount = -1;

            if ((LinkLabel)operation_sender != null)
            {
                LinkLabel linklable = operation_sender as LinkLabel;
                if (linklable.Name.Equals("lb_first"))
                {
                    CurrentPage        = 1;
                    l_totalPage.Text   = PageCount.ToString();
                    l_currentPage.Text = CurrentPage.ToString();
                    dt = DbHelperSQL.CommonPagination(tableName, tableName + ".id", tableName + ".id", CurrentPage, PageSize, "*", GetSelCond, "", ref tempCount);
                    dg_infoSource.DataSource = dt;
                }
                if (linklable.Name.Equals("lb_pre"))
                {
                    if (CurrentPage >= 2)
                    {
                        CurrentPage -= 1;
                    }
                    l_totalPage.Text   = PageCount.ToString();
                    l_currentPage.Text = CurrentPage.ToString();
                    dt = DbHelperSQL.CommonPagination(tableName, tableName + ".id", tableName + ".id", CurrentPage, PageSize, "*", GetSelCond, "", ref tempCount);
                    dg_infoSource.DataSource = dt;
                }
                if (linklable.Name.Equals("lb_next"))
                {
                    if (CurrentPage < PageCount)
                    {
                        CurrentPage += 1;
                    }
                    else
                    {
                        CurrentPage = PageCount;
                    }
                    l_totalPage.Text   = PageCount.ToString();
                    l_currentPage.Text = CurrentPage.ToString();
                    dt = DbHelperSQL.CommonPagination(tableName, tableName + ".id", tableName + ".id", CurrentPage, PageSize, "*", GetSelCond, "", ref tempCount);
                    dg_infoSource.DataSource = dt;
                }
                if (linklable.Name.Equals("lb_last"))
                {
                    CurrentPage        = PageCount;
                    l_totalPage.Text   = PageCount.ToString();
                    l_currentPage.Text = CurrentPage.ToString();
                    dt = DbHelperSQL.CommonPagination(tableName, tableName + ".id", tableName + ".id", CurrentPage, PageSize, "*", GetSelCond, "", ref tempCount);
                    dg_infoSource.DataSource = dt;
                }
            }
        }