private void initForm() { DOPhanCongCongViec do_pccv = new DOPhanCongCongViec(); do_pccv = DACongViec.LoadPCCV(PCCV_ID); txtNguoiCapNhat.Text = DACongViec.getNameNV(NV_ID); txtTenDuAn.Text = do_pccv.CONG_VIEC; txtThoiGianCapNhat.Text = HelpDB.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING); }
public void RefreshDataAfterInsert(DOPhanCongCongViec doPhanCongCV, string nguoiThucHien, string tienDo) { DataRow dr = gridViewMaster.GetDataRow(gridViewMaster.FocusedRowHandle); dr["TEN_LCV"] = DACongViec.getTenLoaiCV(doPhanCongCV.LCV_ID); dr["TU_NGAY"] = doPhanCongCV.NGAY_BAT_DAU; if (doPhanCongCV.NGAY_KET_THUC_DU_KIEN != null) { dr["DEN_NGAY"] = doPhanCongCV.NGAY_KET_THUC_DU_KIEN; } else { dr["DEN_NGAY"] = DBNull.Value; } if (doPhanCongCV.IS_NGAY == "Y") { string a =HelpNumber.RoundDecimal(doPhanCongCV.THOI_GIAN_DU_KIEN.Value * 8 + HelpNumber.ParseDecimal(0.01),1) + " Giờ"; string b = a.Replace(',', '.'); dr["THOI_GIAN_DU_KIEN"] = b; } else { string a = HelpNumber.RoundDecimal(doPhanCongCV.THOI_GIAN_DU_KIEN.Value + HelpNumber.ParseDecimal(0.01), 1) + " Giờ"; string b = a.Replace(',', '.'); dr["THOI_GIAN_DU_KIEN"] = b; } dr["CONG_VIEC"] = doPhanCongCV.CONG_VIEC; dr["NGUOI_GIAO"] = doPhanCongCV.NGUOI_GIAO; dr["TINH_TRANG"] = DACongViec.getTinhTrang(doPhanCongCV.TINH_TRANG); dr["TEN_MUC_UU_TIEN"] = DACongViec.getMucUuTien(doPhanCongCV.MUC_UU_TIEN); dr["TONG_TIEN_DO"] = tienDo; dr["NV_THAM_GIA"] = nguoiThucHien; }
public static bool LuuCongViec(bool? IsAdd,DOPhanCongCongViec phanCongCV,List<DOChiTietPhanCong> cacChiTietPhanCong) { bool ok = true; DatabaseFB db = HelpDB.getDatabase(); DbTransaction dbTrans = db.BeginTransaction(db.OpenConnection()); try { #region lưu bảng phân công string sqlPC = SQL_STRING_INSERT_PCCV; if (IsAdd == false)//update sqlPC = SQL_STRING_UPDATE_PCCV; DbCommand cmdPC = db.GetSQLStringCommand(sqlPC); db.AddInParameter(cmdPC, "@PCCV_ID", DbType.Int64, phanCongCV.PCCV_ID); db.AddInParameter(cmdPC, "@MO_TA", DbType.String, phanCongCV.MO_TA); db.AddInParameter(cmdPC, "@CONG_VIEC",DbType.String,phanCongCV.CONG_VIEC); db.AddInParameter(cmdPC, "@MUC_UU_TIEN", DbType.Int32, phanCongCV.MUC_UU_TIEN); db.AddInParameter(cmdPC, "@TINH_TRANG", DbType.Int64, phanCongCV.TINH_TRANG); db.AddInParameter(cmdPC, "@NGAY_BAT_DAU", DbType.DateTime, phanCongCV.NGAY_BAT_DAU); db.AddInParameter(cmdPC, "@NGAY_KET_THUC", DbType.DateTime, phanCongCV.NGAY_KET_THUC); db.AddInParameter(cmdPC, "@NGAY_KET_THUC_DU_KIEN", DbType.DateTime, phanCongCV.NGAY_KET_THUC_DU_KIEN); db.AddInParameter(cmdPC, "@THOI_GIAN_DU_KIEN", DbType.Int32, phanCongCV.THOI_GIAN_DU_KIEN); db.AddInParameter(cmdPC, "@IS_NGAY", DbType.String, phanCongCV.IS_NGAY); db.AddInParameter(cmdPC, "@NGUOI_GIAO", DbType.Int64, phanCongCV.NGUOI_GIAO); db.AddInParameter(cmdPC, "@LCV_ID", DbType.Int64, phanCongCV.LCV_ID); db.AddInParameter(cmdPC, "@IS_CONG_VIEC_KH", DbType.String, phanCongCV.IS_CONG_VIEC_KH); db.AddInParameter(cmdPC, "@CHI_TIET_CONG_VIEC", DbType.Binary, phanCongCV.CHI_TIET_CONG_VIEC); if (db.ExecuteNonQuery(cmdPC, dbTrans) < 0) ok = false; #endregion #region lưu bảng chi tiết phân công if (IsAdd == false && cacChiTietPhanCong.Count > 0)//update { DbCommand cmdDel = db.GetSQLStringCommand(SQL_STRING_DELETE_CTPC); db.AddInParameter(cmdDel, "@PCCV_ID", DbType.Int64, phanCongCV.PCCV_ID); if (db.ExecuteNonQuery(cmdDel, dbTrans) < 0) ok = false; } foreach (DOChiTietPhanCong chiTietPC in cacChiTietPhanCong) { DbCommand cmdCTPC = db.GetSQLStringCommand(SQL_STRING_INSERT_CTPC); db.AddInParameter(cmdCTPC, "@PCCV_ID", DbType.Int64, chiTietPC.PCCV_ID); db.AddInParameter(cmdCTPC, "@MANV", DbType.Int64, chiTietPC.MA_NV); db.AddInParameter(cmdCTPC, "@PHAN_TRAM_THAM_GIA", DbType.Int32, chiTietPC.PHAN_TRAM_THAM_GIA); db.AddInParameter(cmdCTPC, "@TIEN_DO", DbType.Int32, chiTietPC.TIEN_DO); db.AddInParameter(cmdCTPC, "@GHI_CHU", DbType.String, chiTietPC.GHI_CHU); db.AddInParameter(cmdCTPC, "@THOI_GIAN_CAP_NHAT", DbType.DateTime, chiTietPC.THOI_GIAN_CAP_NHAT); if (db.ExecuteNonQuery(cmdCTPC, dbTrans) < 0) { ok = false; break; } } db.CommitTransaction(dbTrans); #endregion } catch(Exception e) { HelpMsgBox.ShowNotificationMessage(e.ToString()); db.RollbackTransaction(dbTrans); return false; } return ok; }
private void initForm() { DOPhanCongCongViec do_pccv=new DOPhanCongCongViec(); do_pccv = DACongViec.LoadPCCV(PCCV_ID); txtNguoiCapNhat.Text = DACongViec.getNameNV(NV_ID); txtTenDuAn.Text = do_pccv.CONG_VIEC; txtThoiGianCapNhat.Text = HelpDB.getDatabase().GetSystemCurrentDateTime().ToString(PLConst.FORMAT_DATETIME_STRING); ztbarTienDoThucHien.Value = DACongViec.tienDoCuoi(NV_ID, PCCV_ID); lblTienDo.Text = ztbarTienDoThucHien.Value.ToString() ; gridViewTienDoThuHien.OptionsBehavior.AutoExpandAllGroups = true; initGrid(); }
public static DOPhanCongCongViec LoadPCCV(long pccv_id) { DOPhanCongCongViec doPccv = new DOPhanCongCongViec(); string sql = "SELECT * FROM PHAN_CONG_CONG_VIEC PCCV WHERE PCCV.PCCV_ID='" + pccv_id + "'"; DataSet ds = HelpDB.getDatabase().LoadDataSet(sql); DataRow row; if(ds.Tables[0].Rows.Count>0) { row = ds.Tables[0].Rows[0]; doPccv.PCCV_ID = HelpNumber.ParseInt64(row["PCCV_ID"]); doPccv.CONG_VIEC = row["CONG_VIEC"].ToString(); doPccv.MO_TA = row["MO_TA"].ToString(); doPccv.LCV_ID = HelpNumber.ParseInt64(row["LCV_ID"]); doPccv.MUC_UU_TIEN = HelpNumber.ParseInt64(row["MUC_UU_TIEN"]); doPccv.TINH_TRANG = HelpNumber.ParseInt64(row["TINH_TRANG"]); if (row["THOI_GIAN_DU_KIEN"].ToString() != string.Empty) doPccv.THOI_GIAN_DU_KIEN = HelpNumber.ParseDecimal(row["THOI_GIAN_DU_KIEN"]); doPccv.NGUOI_GIAO = HelpNumber.ParseInt64(row["NGUOI_GIAO"]); if (row["NGAY_BAT_DAU"].ToString() != "") doPccv.NGAY_BAT_DAU = Convert.ToDateTime(row["NGAY_BAT_DAU"]); if (row["NGAY_KET_THUC"].ToString() != "") doPccv.NGAY_KET_THUC = Convert.ToDateTime(row["NGAY_KET_THUC"]); if (row["NGAY_KET_THUC_DU_KIEN"].ToString() != "") doPccv.NGAY_KET_THUC_DU_KIEN = Convert.ToDateTime(row["NGAY_KET_THUC_DU_KIEN"]); doPccv.IS_NGAY = row["IS_NGAY"].ToString(); //CHAUTV if (row["CHI_TIET_CONG_VIEC"] != DBNull.Value) doPccv.CHI_TIET_CONG_VIEC = (byte[])row["CHI_TIET_CONG_VIEC"]; } return doPccv; }