public static BG_Quota AddBG_Quota(BG_Quota bG_Quota) { string sql = "INSERT BG_Quota (PIID, Money, Qtime, DepID)" + "VALUES (@PIID, @Money, @Qtime, @DepID)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@PIID", bG_Quota.PIID), new SqlParameter("@Money", bG_Quota.Money), new SqlParameter("@Qtime", bG_Quota.Qtime), new SqlParameter("@DepID", bG_Quota.DepID) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return(GetBG_QuotaByQtID(newId)); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static BG_Quota GetBG_QuotaByQtID(int qtID) { string sql = "SELECT * FROM BG_Quota WHERE QtID = @QtID"; try { SqlParameter para = new SqlParameter("@QtID", qtID); DataTable dt = DBUnity.AdapterToTab(sql, para); if (dt.Rows.Count > 0) { BG_Quota bG_Quota = new BG_Quota(); bG_Quota.QtID = dt.Rows[0]["QtID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["QtID"]; bG_Quota.PIID = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"]; bG_Quota.Money = dt.Rows[0]["Money"] == DBNull.Value ? "" : (string)dt.Rows[0]["Money"]; bG_Quota.Qtime = dt.Rows[0]["Qtime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["Qtime"]; bG_Quota.DepID = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"]; return(bG_Quota); } else { return(null); } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public void Edit(int id, string PayPrjName, string oldValue, string newValue, object customer) { string message = "<b>编号:</b> {0}<br /><b>科目:</b> {1}<br /><b>原定额:</b> {2}<br /><b>更改定额:</b> {3}"; // Send Message... X.Msg.Notify(new NotificationConfig() { Title = "Edit Record #" + id.ToString(), Html = string.Format(message, id, PayPrjName, oldValue, newValue), Width = 250 }).Show(); BG_Quota qt = BG_QuotaManager.GetBG_QuotaByQtID(id); qt.Money = newValue; BG_QuotaManager.ModifyBG_Quota(qt); }
public static bool ModifyBG_Quota(BG_Quota bG_Quota) { string sql = "UPDATE BG_Quota " + "SET " + "PIID = @PIID, " + "Money = @Money, " + "Qtime = @Qtime, " + "DepID = @DepID " + "WHERE QtID = @QtID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@QtID", bG_Quota.QtID), new SqlParameter("@PIID", bG_Quota.PIID), new SqlParameter("@Money", bG_Quota.Money), new SqlParameter("@Qtime", bG_Quota.Qtime), new SqlParameter("@DepID", bG_Quota.DepID) }; int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para); if (t > 0) { return(true); } else { return(false); } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool ModifyBG_Quota(BG_Quota bG_Quota) { return(BG_QuotaService.ModifyBG_Quota(bG_Quota)); }
public static bool DeleteBG_Quota(BG_Quota bG_Quota) { return(BG_QuotaService.DeleteBG_Quota(bG_Quota)); }
public static BG_Quota AddBG_Quota(BG_Quota bG_Quota) { return(BG_QuotaService.AddBG_Quota(bG_Quota)); }
public static bool DeleteBG_Quota(BG_Quota bG_Quota) { return(DeleteBG_QuotaByQtID(bG_Quota.QtID)); }