public IObservable <int> Update(T entity) { var parameters = ToUpdateParams(entity); var cmd = UpdateSql.ToCmd(CommandType.Text, parameters); return(Db.ExecuteNonQuery(cmd)); }
/// <summary> /// Handles this instance. /// </summary> public Result Handle(Input input) { var Result = new Result(); var tableName = input.TableName; if (tableName.IsNullOrEmpty()) { Result.ErrorMessage = "Herhangi bir tablo ismi seçilmelidir"; return(Result); } var connectionInfo = FindProcedureContainerDatabaseConnectionInfo(input.TableName); if (connectionInfo == null) { return(Result); } var info = DbItemNameInfoParser.Parse(tableName); var writerContext = new WriterContext { Config = new TableConfig { TableName = info.Name, SchemaName = info.SchemaName, DatabaseName = info.DatabaseName ?? DatabaseNames.BOA, DatabaseEnumName = connectionInfo.DatabaseName, ServerNameForTakeTableInformation = ServerNames.GetServerNameOfConnectionString(connectionInfo.ConnectionStringDev) } }; new NamingConvention { Context = writerContext }.InitializeNames(); var generator = new UpdateSql(writerContext); Result.GeneratedSQLCode = generator.Generate(); return(Result); }
/// <summary> /// 选中(2)。上一床(-1)。下一床(1) /// </summary> /// <param name="Groupno"></param> /// <param name="BedNo"></param> /// <param name="TopBottom"></param> public void SelectRow(string Groupno, string BedNo, int TopBottom, int rows) { ColorS(); DataGridViewRow dr = new DataGridViewRow(); int Selectrow = 0; int count = 0; if (TopBottom == 2) { //选中 for (int i = rows; i < Dgv_Info.Rows.Count; i++) { //if (i < Dgv_Info.Rows.Count) //{ dr = Dgv_Info.Rows[i]; if (dr.Cells["组号"].Value.ToString().Trim() == Groupno.Trim()) { Selectrow = i; Dgv_Info.Rows[Selectrow].Selected = true; //this.Dgv_Info.FirstDisplayedScrollingRowIndex = Selectrow; Dgv_Info.Rows[i].DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(SelectColor); break; } //} } } else { //上一床 if (TopBottom == -1) { for (int i = rows - 1; i >= 0; i--) { dr = Dgv_Info.Rows[i]; if (dr.Cells["床号"].Value.ToString().Trim().CompareTo(BedNo.Trim()) != 0 && dr.Cells["组号"].Value.ToString().Trim().CompareTo(Groupno.Trim()) != 0 && dr.Cells["床号"].Value.ToString().Trim().CompareTo(Dgv_Info.Rows[i + 1].Cells["床号"].Value.ToString().Trim()) != 0 && dr.Cells["组号"].Value.ToString().Trim().CompareTo(Dgv_Info.Rows[i + 1].Cells["组号"].Value.ToString().Trim()) != 0 && count > 0) { Selectrow = i; break; } else { count++; } } } else { //下一床 for (int i = rows; i < Dgv_Info.Rows.Count; i++) { if (i < Dgv_Info.Rows.Count) { dr = Dgv_Info.Rows[i]; if (dr.Cells["床号"].Value.ToString().Trim() != BedNo.Trim()) { Selectrow = i; break; } } else { } } } //①如果是上一床。并且传递到Med控件里的行数大于要选中的行数的话 //②如果是下一床。并且传递到Med控件里的行数小于于要选中的行数的话 //如果没有上一床 或者是没有下一床了。 if ((TopBottom == 1 && rows < Selectrow) || (TopBottom == -1 && rows > Selectrow)) { if (TopBottom == -1 && rows > Selectrow && count > 0 && Selectrow != 0) { Selectrow = Selectrow + 1; } } else if (Selectrow >= 0) { Selectrow = 0; } UpdateSql update = new UpdateSql(); if (BedNo == Dgv_Info.Rows[Dgv_Info.Rows.Count - 1].Cells["床号"].Value.ToString() && TopBottom == 1) { DialogResult result = MessageBox.Show("所选病区批次均已排完,是否发送?", "确定发送当前列表的所有瓶签吗? ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { int B = DB.SetPIVAsDB(update.IVRecordBatchSaved(pvb.datetime.ToString("yyyyMMdd"), "", pvb.ward, pvb.Choose)); if (B > 0) { ((UserControlBatch)(this.Parent.Parent.Parent)).ShowWard(0, false); //((Pivasbatch)(this.Parent.Parent.Parent)).ClickWard(1, ""); ((UserControlBatch)(this.Parent.Parent.Parent)).ShowSelectWard(); } } } else { Dgv_Info.Rows[Selectrow].Cells[0].Selected = true; string[] a = Dgv_Info.Rows[Selectrow].Cells["病区"].Value.ToString().Split('('); ((UserControlBatch)(this.Parent.Parent.Parent)).med1.Wardcode = a[1].Substring(0, a[1].Length - 1); //this.Dgv_Info.FirstDisplayedScrollingRowIndex = Selectrow; Dgv_Info.Rows[Selectrow].DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(SelectColor); string PetCode = Dgv_Info.Rows[Selectrow].Cells["病人编码"].Value.ToString(); string Naem = a[0] + " " + Dgv_Info.Rows[Selectrow].Cells["床号"].Value.ToString().Replace("床", "") + "床" + " " + Dgv_Info.Rows[Selectrow].Cells["姓名"].Value.ToString(); ((UserControlBatch)(this.Parent.Parent.Parent)).med1.Visible = true; ((UserControlBatch)(this.Parent.Parent.Parent)).med1.AddMed(PetCode, tf, IsSame, "", "", Dgv_Info.Rows[0].Cells["批次规则"].Value.ToString()); ((UserControlBatch)(this.Parent.Parent.Parent)).med1.Label_Info.Text = Naem; ((UserControlBatch)(this.Parent.Parent.Parent)).med1.rows = Selectrow; ((UserControlBatch)(this.Parent.Parent.Parent)).med1.Label_BedNo.Text = Dgv_Info.Rows[Selectrow].Cells["床号"].Value.ToString(); } } }