public bool InsertData(string userID, ProductMonthData data) { bool ret = true; DALObj.PRODUCT = DALObj.doGetProduct(data.CODE); DALObj.M1 = data.Month[0]; DALObj.M2 = data.Month[1]; DALObj.M3 = data.Month[2]; DALObj.M4 = data.Month[3]; DALObj.M5 = data.Month[4]; DALObj.M6 = data.Month[5]; DALObj.M7 = data.Month[6]; DALObj.M8 = data.Month[7]; DALObj.M9 = data.Month[8]; DALObj.M10 = data.Month[9]; DALObj.M11 = data.Month[10]; DALObj.M12 = data.Month[11]; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { ret = DALObj.InsertCurrentData(userID, obj.zTrans); if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; throw new ApplicationException(ex.Message); } return ret; }
public ProductMonthData GetData(double PRODUCT) { ProductMonthData data = new ProductMonthData(); if (DALObj.GetDataByPRODUCT(PRODUCT, null)) { data.LOID = DALObj.LOID; data.PRODUCT = DALObj.PRODUCT; data.Month[0] = DALObj.M1; data.Month[1] = DALObj.M2; data.Month[2] = DALObj.M3; data.Month[3] = DALObj.M4; data.Month[4] = DALObj.M5; data.Month[5] = DALObj.M6; data.Month[6] = DALObj.M7; data.Month[7] = DALObj.M8; data.Month[8] = DALObj.M9; data.Month[9] = DALObj.M10; data.Month[10] = DALObj.M11; data.Month[11] = DALObj.M12; } return data; }
private void SetData2(ProductMonthData data2) { for (int i = 0; i < data2.Month.Length; i++) { if (data2.Month[i] == "1") chkMonth.Items[i].Selected = true; else chkMonth.Items[i].Selected = false; } }
private ProductMonthData GetData2() { ProductMonthData data2 = new ProductMonthData(); string[] m = new string[12]; foreach (ListItem item in chkMonth.Items) { if (item.Selected) m[int.Parse(item.Value) - 1] = "1"; else m[int.Parse(item.Value) - 1] = "0"; } data2.Month = m; data2.CODE = this.txtCode.Text.Trim(); data2.PRODUCT = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text); return data2; }