public static void InsertKNITWRIST(Sale_B_KNITWRIST _Sale_B_KNITWRIST, int SaleId, string User) { DbCommand command = Catalog_Access.CreateCommand(); command.CommandText = "sp_insertSale_B_KNITWRIST"; DbParameter param; param = command.CreateParameter(); param.ParameterName = "@SaleId"; param.Value = SaleId; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@GRAM"; param.Value = _Sale_B_KNITWRIST.GRAM; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@COURSE"; param.Value = _Sale_B_KNITWRIST.COURSE; param.DbType = DbType.String; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@GAUGE"; param.Value = _Sale_B_KNITWRIST.GAUGE; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@GSM"; param.Value = _Sale_B_KNITWRIST.GSM; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@STITCHLENGTH"; param.Value = _Sale_B_KNITWRIST.STITCHLENGTH; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@YARN1"; param.Value = _Sale_B_KNITWRIST.YARN1; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@YARN2"; param.Value = _Sale_B_KNITWRIST.YARN2; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@BRAND1"; param.Value = _Sale_B_KNITWRIST.BRAND1; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@BRAND2"; param.Value = _Sale_B_KNITWRIST.BRAND2; param.DbType = DbType.Int32; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@RATE1"; param.Value = _Sale_B_KNITWRIST.RATE1; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@RATE2"; param.Value = _Sale_B_KNITWRIST.RATE2; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@DYEDBLEACHED"; param.Value = _Sale_B_KNITWRIST.DYEDBLEACHED; param.DbType = DbType.Decimal; command.Parameters.Add(param); param = command.CreateParameter(); param.ParameterName = "@CreatedBy"; param.Value = User; param.DbType = DbType.String; command.Parameters.Add(param); Catalog_Access.ExecuteNonQuery(command); }
public static string Insert(Sale _Sale, Sale_B_KNITTED _Sale_B_KNITTED, List<Sale_B_WOVEN> list_Sale_B_WOVEN, Sale_B_NONWOVEN _Sale_B_NONWOVEN, Sale_B_TERRY _Sale_B_TERRY, Sale_B_KNITWRIST _Sale_B_KNITWRIST, Sale_B_LEATHER _Sale_B_LEATHER) { _Sale.ID = InsertSale(_Sale); if (_Sale.ID > 0) { if (_Sale_B_KNITTED != null) InsertKNITTED(_Sale_B_KNITTED, _Sale.ID, _Sale.CreatedBy); if (list_Sale_B_WOVEN != null) foreach (Sale_B_WOVEN _Sale_B_WOVEN in list_Sale_B_WOVEN) InsertWOVEN(_Sale_B_WOVEN, _Sale.ID, _Sale.CreatedBy); if (_Sale_B_NONWOVEN != null) InsertNONWOVEN(_Sale_B_NONWOVEN, _Sale.ID, _Sale.CreatedBy); if (_Sale_B_TERRY != null) InsertTERRY(_Sale_B_TERRY, _Sale.ID, _Sale.CreatedBy); if (_Sale_B_KNITWRIST != null) InsertKNITWRIST(_Sale_B_KNITWRIST, _Sale.ID, _Sale.CreatedBy); if (_Sale_B_LEATHER != null) InsertLEATHER(_Sale_B_LEATHER, _Sale.ID, _Sale.CreatedBy); return "0"; } else { return "1"; } }
public string Submit(Sale _Sale, Sale_B_KNITTED _Sale_B_KNITTED, List<Sale_B_WOVEN> list_Sale_B_WOVEN, Sale_B_NONWOVEN _Sale_B_NONWOVEN, Sale_B_TERRY _Sale_B_TERRY, Sale_B_KNITWRIST _Sale_B_KNITWRIST, Sale_B_LEATHER _Sale_B_LEATHER) { string msg = ""; if (_Sale.ID == 0) { _Sale.CreatedBy = Session["User"].ToString(); msg = Sale_DA.Insert(_Sale, _Sale_B_KNITTED, list_Sale_B_WOVEN, _Sale_B_NONWOVEN, _Sale_B_TERRY, _Sale_B_KNITWRIST, _Sale_B_LEATHER); } else { _Sale.UpdatedBy = Session["User"].ToString(); msg = Sale_DA.Update(_Sale, _Sale_B_KNITTED, list_Sale_B_WOVEN, _Sale_B_NONWOVEN, _Sale_B_TERRY, _Sale_B_KNITWRIST, _Sale_B_LEATHER); } return msg; }
public static string Update(Sale _Sale, Sale_B_KNITTED _Sale_B_KNITTED, List<Sale_B_WOVEN> list_Sale_B_WOVEN, Sale_B_NONWOVEN _Sale_B_NONWOVEN, Sale_B_TERRY _Sale_B_TERRY, Sale_B_KNITWRIST _Sale_B_KNITWRIST, Sale_B_LEATHER _Sale_B_LEATHER) { if (UpdateSale(_Sale) == "4") { if (_Sale_B_KNITTED != null) if (_Sale_B_KNITTED.Id == 0) InsertKNITTED(_Sale_B_KNITTED, _Sale.ID, _Sale.UpdatedBy); else UpdateKNITTED(_Sale_B_KNITTED, _Sale.ID, _Sale.UpdatedBy); if (list_Sale_B_WOVEN != null) foreach (Sale_B_WOVEN _Sale_B_WOVEN in list_Sale_B_WOVEN) { if (_Sale_B_WOVEN.Id == 0) InsertWOVEN(_Sale_B_WOVEN, _Sale.ID, _Sale.UpdatedBy); else UpdateWOVEN(_Sale_B_WOVEN, _Sale.ID, _Sale.UpdatedBy); } if (_Sale_B_NONWOVEN != null) if (_Sale_B_NONWOVEN.Id == 0) InsertNONWOVEN(_Sale_B_NONWOVEN, _Sale.ID, _Sale.UpdatedBy); else UpdateNONWOVEN(_Sale_B_NONWOVEN, _Sale.ID, _Sale.UpdatedBy); if (_Sale_B_TERRY != null) if (_Sale_B_TERRY.Id == 0) InsertTERRY(_Sale_B_TERRY, _Sale.ID, _Sale.UpdatedBy); else UpdateTERRY(_Sale_B_TERRY, _Sale.ID, _Sale.UpdatedBy); if (_Sale_B_KNITWRIST != null) if (_Sale_B_KNITWRIST.Id == 0) InsertKNITWRIST(_Sale_B_KNITWRIST, _Sale.ID, _Sale.UpdatedBy); else UpdateKNITWRIST(_Sale_B_KNITWRIST, _Sale.ID, _Sale.UpdatedBy); if (_Sale_B_LEATHER != null) if (_Sale_B_LEATHER.Id == 0) InsertLEATHER(_Sale_B_LEATHER, _Sale.ID, _Sale.UpdatedBy); else UpdateLEATHER(_Sale_B_LEATHER, _Sale.ID, _Sale.UpdatedBy); return "4"; } else { return "1"; } }
public Sale_B_KNITWRIST GetKNITWRIST(int SaleId) { Sale_B_KNITWRIST _Sale_B_KNITWRIST = null; DataTable dt = Sale_DA.GetKNITWRIST(SaleId); foreach (DataRow row in dt.Rows) { _Sale_B_KNITWRIST = new Sale_B_KNITWRIST(); _Sale_B_KNITWRIST.Id = int.Parse(row["Id"].ToString()); if (row["GRAM"].ToString() != "") _Sale_B_KNITWRIST.GRAM = float.Parse(row["GRAM"].ToString()); _Sale_B_KNITWRIST.COURSE = row["COURSE"].ToString(); if (row["GAUGE"].ToString() != "") _Sale_B_KNITWRIST.GAUGE = float.Parse(row["GAUGE"].ToString()); if (row["GSM"].ToString() != "") _Sale_B_KNITWRIST.GSM = float.Parse(row["GSM"].ToString()); if (row["STITCHLENGTH"].ToString() != "") _Sale_B_KNITWRIST.STITCHLENGTH = float.Parse(row["STITCHLENGTH"].ToString()); if (row["YARN1"].ToString() != "") _Sale_B_KNITWRIST.YARN1 = int.Parse(row["YARN1"].ToString()); if (row["YARN2"].ToString() != "") _Sale_B_KNITWRIST.YARN2 = int.Parse(row["YARN2"].ToString()); if (row["BRAND1"].ToString() != "") _Sale_B_KNITWRIST.BRAND1 = int.Parse(row["BRAND1"].ToString()); if (row["BRAND2"].ToString() != "") _Sale_B_KNITWRIST.BRAND2 = int.Parse(row["BRAND2"].ToString()); if (row["RATE1"].ToString() != "") _Sale_B_KNITWRIST.RATE1 = float.Parse(row["RATE1"].ToString()); if (row["RATE2"].ToString() != "") _Sale_B_KNITWRIST.RATE2 = float.Parse(row["RATE2"].ToString()); if (row["DYEDBLEACHED"].ToString() != "") _Sale_B_KNITWRIST.DYEDBLEACHED = float.Parse(row["DYEDBLEACHED"].ToString()); } return _Sale_B_KNITWRIST; }