//Các phương thức khởi tạo của Class #region "Constructors" public frm_danhmuc_loaithuoc() { InitializeComponent(); m_Query = DmucLoaithuoc.CreateQuery(); InitEvents(); }
public frm_dmuc_benhvien() { InitializeComponent(); m_Query = DmucBenhvien.CreateQuery(); InitEvents(); }
public frm_dmuc_doituongkcb() { InitializeComponent(); m_Query = DmucDoituongkcb.CreateQuery(); InitEvents(); }
/// <summary> /// DEPRECATED we are binding in code-behind. Filter data grid by company id using FetchbyQuery method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void objdsContact_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { int _cid = Request.QueryString["cid"] != null?wwi_func.vint(Request.QueryString["cid"].ToString()) : -1; SubSonic.Query _q = new SubSonic.Query(Tables.ContactTable, "WWIProv").WHERE("CompanyID", SubSonic.Comparison.Equals, _cid); e.InputParameters["qry"] = _q; }
//Các phương thức khởi tạo của Class #region "Constructors" public frm_dmuc_benhvien() { InitializeComponent(); m_Query = DmucBenhvien.CreateQuery(); InitEvents(); }
public frm_danhmuc_loaithuoc() { InitializeComponent(); m_Query = DmucLoaithuoc.CreateQuery(); InitEvents(); }
//Các phương thức khởi tạo của Class #region "Constructors" public frm_dmuc_doituongkcb() { InitializeComponent(); m_Query = DmucDoituongkcb.CreateQuery(); InitEvents(); }
public frm_danhmuc_loaithuoc(string Kieuthuoc_vattu) { InitializeComponent(); this.Kieuthuoc_vattu = Kieuthuoc_vattu; tenloai = Kieuthuoc_vattu == "THUOC" ? " thuốc " : " vật tư "; lbltendanhmuc.Text = Kieuthuoc_vattu == "THUOC" ? " Danh mục loại thuốc " : " Danh mục loại vật tư "; m_Query = DmucLoaithuoc.CreateQuery(); InitEvents(); }
protected void bind_order_titles() { //get order number from querystrings Int32 _orderno = wwi_func.vint(wwi_security.DecryptString(get_token("pno"), "publiship")); //999909; //Request.QueryString["pid"] != null ? wwi_func.vint(Request.QueryString["pid"].ToString()) : 0; //query item table SubSonic.Query _q = new SubSonic.Query(DAL.Logistics.Tables.ItemTable, "WWIProv").WHERE("OrderNumber", Comparison.Equals, _orderno); DataSet _ds = _q.ExecuteDataSet(); this.dxgridTitles.KeyFieldName = "TitleID"; this.dxgridTitles.DataSource = _ds; this.dxgridTitles.DataBind(); }
/// </summary> /// <param name="companyID"></param> protected void bind_contacts(int companyid) { ASPxGridView _grid = (ASPxGridView)this.fmvAddressBook.FindControl("dxgridCompanyContacts"); //ASPxGridView _grid = (ASPxGridView)this.dxpnlContacts.FindControl("dxgridCompanyContacts"); if (_grid != null) { SubSonic.Query _q = new SubSonic.Query(Tables.ContactTable, "WWIProv").WHERE("CompanyID", Comparison.Equals, companyid); DataSet _ds = _q.ExecuteDataSet(); //IDataReader _dr = _q.ExecuteReader(); can't use datareder it's a read only structure! _grid.KeyFieldName = "ContactID"; _grid.DataSource = _ds; _grid.DataBind(); } }
/// <summary> /// hàm thực hiện việc khởi tạo thông tin của thuốc /// </summary> /// <param name="p_strDrugOnly"></param> public frm_themmoi_thuoc(string p_strDrugOnly) { InitializeComponent(); InitializeEvents(); m_Query = DmucThuoc.CreateQuery(); m_QueryCmd = m_Query.BuildSelectCommand(); //Khởi tạo các giá trị mặc định. Có thể đặt ở Form load và có thể sử dụng Thread để Load trong //một số trường hợp cần cải thiện Performance if (p_strDrugOnly.ToUpper() == "DRUGONLY") { } txtCode.Enabled = false; cboDrugNature.SelectedIndex = 0; }
//Các phương thức khởi tạo của Class #region "Constructors" /// <summary> /// hàm thực hiện việc khởi tạo thông tin của thuốc /// </summary> /// <param name="p_strDrugOnly"></param> public frm_themmoi_thuoc(string p_strDrugOnly) { InitializeComponent(); InitializeEvents(); m_Query = DmucThuoc.CreateQuery(); m_QueryCmd = m_Query.BuildSelectCommand(); //Khởi tạo các giá trị mặc định. Có thể đặt ở Form load và có thể sử dụng Thread để Load trong //một số trường hợp cần cải thiện Performance if (p_strDrugOnly.ToUpper() == "DRUGONLY") { } txtCode.Enabled = false; cboDrugNature.SelectedIndex = 0; }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); //Gọi Business cập nhật dữ liệu int v_intObjectTypeID = Convert.ToInt32(txtID.Text); //Kiểm tra trùng tên đối tượng và cảnh báo DmucDoituongkcbCollection v_arrSameNameObject = new DmucDoituongkcbController() .FetchByQuery(m_Query.AddWhere(DmucDoituongkcb.Columns.TenDoituongKcb, Comparison.Equals, txtName.Text.Trim().ToUpper()) .AND(DmucDoituongkcb.Columns.IdDoituongKcb, Comparison.NotEquals, v_intObjectTypeID)); if (v_arrSameNameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có đối tượng có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { return; } } int actionResult = CreateObjectType(); if (actionResult > -1) { m_DataSource.Sort(DmucDoituongkcb.Columns.SttHthi, true); ProcessData1(); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, DmucDoituongkcb.Columns.IdLoaidoituongKcb, txtID.Text.Trim()); SetControlStatus(); Utility.ShowMsg("Cập nhật dữ liệu thành công."); } else { Utility.ShowMsg("Bạn gặp lỗi trong quá trình cập nhập", "Thông báo"); return; } }
protected void bind_gridview() { //string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship"); //CourierDetailsSubTableCollection _c = new CourierDetailsSubTableCollection().Where("OrderNumber", Comparison.Equals, _orderno); int _orderno = wwi_func.vint(wwi_security.DecryptString(get_token("pno"), "publiship")); //999909; //Request.QueryString["pid"] != null ? wwi_func.vint(Request.QueryString["pid"].ToString()) : 0; try { //query courier details table SubSonic.Query _q = new SubSonic.Query(Tables.CourierDetailsSubTable, "WWIProv").WHERE("OrderNumber", Comparison.Equals, _orderno); DataSet _ds = _q.ExecuteDataSet(); this.dxgrdCourier.KeyFieldName = "CourierDetailID"; this.dxgrdCourier.DataSource = _ds; this.dxgrdCourier.DataBind(); } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = string.Format("Order Number {0}. Error: {1}", _orderno, _ex); this.dxpnlErr.ClientVisible = true; }//end try }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { //Kiểm tra trùng tên đối tượng và cảnh báo DmucDoituongkcbCollection v_arrSameNameObject = new DmucDoituongkcbController().FetchByQuery(m_Query.AddWhere(DmucDoituongkcb.Columns.TenDoituongKcb, txtName.Text.Trim().ToUpper())); if (v_arrSameNameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có đối tượng có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause txtName.Focus(); m_Query = DmucDoituongkcb.CreateQuery(); return; } } //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); // Lấy về MaxID vừa được thêm vào CSDL int actionResult = CreateObjectType(); if (actionResult > 0) { ProcessData(actionResult); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, DmucDoituongkcb.Columns.IdLoaidoituongKcb, actionResult.ToString()); Utility.ShowMsg("Thêm mới dữ liệu thành công!"); SetControlStatus(); this.Activate(); } else//Có lỗi xảy ra { Utility.ShowMsg("Thêm mới không thành công. Mời bạn xem lại"); } }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { Utility.SetMsg(lblMsg, "", true); //Gọi Business cập nhật dữ liệu int v_shtIdLoaithuoc = Convert.ToInt32(txtID.Text); //Kiểm tra trùng tên đối tượng và cảnh báo DmucLoaithuocCollection v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ma_loaithuoc", txtDrug_Code.Text.Trim().ToUpper()).AND("Id_Loaithuoc", Comparison.NotEquals, v_shtIdLoaithuoc)); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm"+tenloai+"có mã:" + txtDrug_Code.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); return; } } v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ten_loaithuoc", txtName.Text.Trim().ToUpper()).AND("Id_Loaithuoc", Comparison.NotEquals, v_shtIdLoaithuoc)); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm"+tenloai+"có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); return; } } //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); DmucLoaithuoc v_NewObjectChangePos = null; DmucLoaithuoc objDrugType = DmucLoaithuoc.FetchByID(Convert.ToInt16(txtID.Text)); if (objDrugType != null) { objDrugType.MaLoaithuoc = Utility.sDbnull(txtDrug_Code.Text); objDrugType.TenLoaithuoc = Utility.sDbnull(txtName.Text); objDrugType.MotaThem = Utility.sDbnull(txtDesc.Text); objDrugType.MaNhomthuoc = Utility.sDbnull(cboNhom.SelectedValue, ""); objDrugType.SttHthi = Convert.ToInt16(txtPos.Text); objDrugType.InRieng = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); objDrugType.KieuThuocvattu = Kieuthuoc_vattu; objDrugType.IsNew = false; objDrugType.MarkOld(); objDrugType.Save(); } DataRow[] arrDr = m_dtLoaithuoc.Select(DmucLoaithuoc.Columns.IdLoaithuoc + "=" + txtID.Text); if (arrDr.Length > 0) { arrDr[0][DmucLoaithuoc.Columns.MaLoaithuoc] = Utility.sDbnull(txtDrug_Code.Text); arrDr[0][DmucLoaithuoc.Columns.TenLoaithuoc] = Utility.sDbnull(txtName.Text); arrDr[0][DmucLoaithuoc.Columns.MotaThem] = Utility.sDbnull(txtDesc.Text); arrDr[0][DmucLoaithuoc.Columns.MaNhomthuoc] = Utility.sDbnull(cboNhom.SelectedValue, ""); arrDr[0][DmucLoaithuoc.Columns.SttHthi] = Convert.ToInt16(txtPos.Text); arrDr[0][DmucLoaithuoc.Columns.InRieng] = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); arrDr[0][DmucLoaithuoc.Columns.KieuThuocvattu] = Kieuthuoc_vattu; arrDr[0]["ten_nhomthuoc"] = cboNhom.Text; } //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, "Id_Loaithuoc", txtID.Text.Trim()); SetControlStatus(); Utility.SetMsg(lblMsg, "Cập nhật dữ liệu thành công.",false); }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { Utility.SetMsg(lblMsg, "", true); //Kiểm tra trùng tên đối tượng và cảnh báo DmucLoaithuocCollection v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ma_loaithuoc", txtDrug_Code.Text.Trim().ToUpper())); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm thuốc có mã:" + txtDrug_Code.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); txtDrug_Code.Focus(); return; } } v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ten_loaithuoc", txtName.Text.Trim().ToUpper())); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm"+tenloai+"có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); txtName.Focus(); return; } } //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); //Gọi nghiệp vụ Insert dữ liệu DmucLoaithuoc objDrugType=new DmucLoaithuoc(); objDrugType.MaLoaithuoc = Utility.sDbnull(txtDrug_Code.Text); objDrugType.TenLoaithuoc = Utility.sDbnull(txtName.Text); objDrugType.MotaThem = Utility.sDbnull(txtDesc.Text); objDrugType.MaNhomthuoc= Utility.sDbnull(cboNhom.SelectedValue, ""); objDrugType.SttHthi = Convert.ToInt16(txtPos.Text); objDrugType.InRieng = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); objDrugType.KieuThuocvattu = Kieuthuoc_vattu; objDrugType.IsNew = true; objDrugType.Save(); //Lấy về MaxID vừa được thêm vào CSDL int v_shtIdLoaithuoc = objDrugType.IdLoaithuoc; //Lấy về Object vừa tạo DmucLoaithuocCollection v_arrNewObject = new DmucLoaithuocController().FetchByID(v_shtIdLoaithuoc); if (v_arrNewObject.Count > 0)//-->Thêm mới thành công { DataRow newitem=m_dtLoaithuoc.NewRow(); Utility.FromObjectToDatarow(v_arrNewObject[0], ref newitem); newitem["ten_nhomthuoc"] = cboNhom.Text; m_dtLoaithuoc.Rows.Add(newitem); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, "Id_Loaithuoc", v_shtIdLoaithuoc.ToString()); Utility.SetMsg(lblMsg, "Thêm mới dữ liệu thành công!",false); SetControlStatus(); this.Activate(); } else//Có lỗi xảy ra Utility.SetMsg(lblMsg, "Thêm mới không thành công. Mời bạn xem lại",false); }
/// <summary> /// DEPRECATED we are binding in code-behind. Filter data grid by company id using FetchbyQuery method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void objdsContact_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { int _cid = Request.QueryString["cid"] != null ? wwi_func.vint(Request.QueryString["cid"].ToString()) : -1; SubSonic.Query _q = new SubSonic.Query(Tables.ContactTable, "WWIProv").WHERE("CompanyID", SubSonic.Comparison.Equals, _cid); e.InputParameters["qry"] = _q; }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { Utility.SetMsg(lblMsg, "", false); //Gọi Business cập nhật dữ liệu Int16 v_intUpdateDrugID = Convert.ToInt16(txtID.Text); SqlQuery sqlQuery = new Select().From(DmucThuoc.Schema) .Where(DmucThuoc.Columns.MaThuoc).IsEqualTo(txtCode.Text) .And(DmucThuoc.Columns.IdThuoc).IsNotEqualTo(v_intUpdateDrugID); //Kiểm tra nếu trùng Mã Drug Code thì bắt nhập mã khác //DmucThuocCollection v_arrSameCodeObject = new DmucThuocController().FetchByQuery(m_Query.AddWhere("Drug_Code", txtCode.Text.Trim().ToUpper()).AND("id_thuoc", Comparison.NotEquals, v_intUpdateDrugID)); if (sqlQuery.GetRecordCount() > 0) { Utility.SetMsg(lblMsg, "Đã tồn tại thuốc có mã =" + txtCode.Text.Trim() + ".Đề nghị bạn nhập mã khác",true); m_Query = DmucThuoc.CreateQuery(); return; } //Create Again to ignore Where Clause m_Query = DmucThuoc.CreateQuery(); //Tạo giá trị mới cho đối tượng đang cần Update DmucThuoc objnewItems = DmucThuoc.FetchByID(objThuoc.IdThuoc); objnewItems.IdThuoc = v_intUpdateDrugID; objnewItems.TenThuoc = Utility.GetValue(txtName.Text, false); objnewItems.TenBhyt = Utility.GetValue(txtTEN_BHYT.Text, false); objnewItems.DonGia = Utility.DecimaltoDbnull( txtDongia.Text,0); objnewItems.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0); objnewItems.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0); objnewItems.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0); objnewItems.MaThuoc = Utility.GetValue(txtCode.Text, false); objnewItems.IdLoaithuoc = Convert.ToInt16(txtLoaithuoc.MyID); objnewItems.TinhChat = Convert.ToByte(cboDrugNature.SelectedIndex); objnewItems.MaDonvitinh = txtDonvitinh.myCode; objnewItems.TuTuc = Utility.Bool2byte(chkTutuc.Checked); objnewItems.MotaThem = Utility.GetValue(txtDesc.Text, false); objnewItems.HoatChat = Utility.GetValue(txtActice.Text, false); objnewItems.NuocSanxuat = txtNuocSX.Text; objnewItems.HangSanxuat = txtHangSX.Text; objnewItems.HamLuong = txtContent.Text; objnewItems.QD31 = Utility.DoTrim(txtQD31.Text); objnewItems.SoDangky = txtNumber_Register.Text; objnewItems.TrangThai = chkHieuLuc.Checked ? (byte)1 : (byte)0; objnewItems.DangBaoche = Utility.DoTrim(txtDangBaoChe.Text); objnewItems.NguoiSua = globalVariables.UserName; objnewItems.NgaySua = DateTime.Now; objnewItems.GioihanKedon = (Int16)Utility.DecimaltoDbnull(txtSoluong.Text, -1); objnewItems.DonviBut = (int)Utility.DecimaltoDbnull(txtBut.Text, -1); objnewItems.CoChiathuoc = Utility.Bool2byte(chkChiathuoc.Checked); objnewItems.MaDvichia = txtDonvichia.myCode; objnewItems.SluongChia = (int)Utility.DecimaltoDbnull(txtSoluongchia.Text, 0); objnewItems.DongiaChia = Utility.DecimaltoDbnull(txtDongiachia.Text, 0); objnewItems.NoitruNgoaitru=optAll.Checked?"ALL":(optNoitru.Checked?"NOI":"NGOAI"); objnewItems.KieuThuocvattu = Utility.sDbnull(cboKIEU_THUOC_VT.SelectedValue); objnewItems.IsNew = false; objnewItems.MarkOld(); objnewItems.Save(); //Update to Datasource to reflect on DataGridView new Update(KcbThanhtoanChitiet.Schema) .Set(KcbThanhtoanChitiet.Columns.DonviTinh).EqualTo(Utility.sDbnull(txtDonvitinh.Text, "Lần")) .Set(KcbThanhtoanChitiet.Columns.TenChitietdichvu).EqualTo(Utility.sDbnull(txtName.Text, "")) .Set(KcbThanhtoanChitiet.Columns.TenBhyt).EqualTo(Utility.sDbnull(txtTEN_BHYT.Text, "")) .Where(KcbThanhtoanChitiet.Columns.IdLoaithanhtoan).IsEqualTo(3) .And(KcbThanhtoanChitiet.Columns.IdChitietdichvu).IsEqualTo(objThuoc.IdThuoc) .Execute(); DataRow dr = Utility.FetchOnebyCondition(m_dtDrugDataSource, "id_thuoc=" + v_intUpdateDrugID.ToString().Trim()); if (dr != null) { Utility.FromObjectToDatarow(objnewItems, ref dr); dr[DmucThuoc.Columns.TinhChat] = Convert.ToByte(cboDrugNature.SelectedIndex); dr["ten_loaithuoc"] = txtLoaithuoc.Text; dr["ten_donvitinh"] = txtDonvitinh.Text; dr["ten_donvichia"] = txtDonvichia.Text; dr[DmucThuoc.Columns.HamLuong] = txtContent.Text; dr[DmucThuoc.Columns.SoDangky] = txtNumber_Register.Text; dr[DmucThuoc.Columns.NuocSanxuat] = txtNuocSX.Text; dr[DmucThuoc.Columns.HangSanxuat] = txtHangSX.Text; m_dtDrugDataSource.AcceptChanges(); } //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn if (grdList != null) Utility.GotoNewRowJanus(grdList, "id_thuoc", txtID.Text.Trim()); SetControlStatus(); Utility.SetMsg(lblMsg, "Cập nhật dữ liệu thành công.", false); this.Close(); }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { try { Utility.SetMsg(lblMsg, "", false); SqlQuery sqlQuery = new Select().From(DmucThuoc.Schema) .Where(DmucThuoc.Columns.MaThuoc).IsEqualTo(txtCode.Text); if (sqlQuery.GetRecordCount() > 0) { Utility.SetMsg(lblMsg, "Đã tồn tại thuốc có mã(Drug Code)=" + txtCode.Text.Trim() + ".Đề nghị bạn nhập mã khác",true); m_Query = DmucThuoc.CreateQuery(); return; } //Bước 0: Thêm mới thuốc DmucThuoc objnewItems = new DmucThuoc(); objnewItems.TenThuoc = Utility.sDbnull(txtName.Text); objnewItems.TenBhyt = Utility.sDbnull(txtTEN_BHYT.Text); objnewItems.MaThuoc = Utility.sDbnull(txtCode.Text); objnewItems.IdLoaithuoc = Utility.Int16Dbnull(txtLoaithuoc.MyID); objnewItems.DonGia = Utility.DecimaltoDbnull( txtDongia.Text, 0); objnewItems.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0); objnewItems.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0); objnewItems.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0); objnewItems.MotaThem = Utility.sDbnull(txtDesc.Text); objnewItems.DangBaoche = Utility.DoTrim(txtDangBaoChe.Text); objnewItems.HamLuong = Utility.sDbnull(txtContent.Text); objnewItems.HangSanxuat = Utility.sDbnull(txtHangSX.Text); objnewItems.TrangThai = chkHieuLuc.Checked ? (byte)1 : (byte)0; objnewItems.TuTuc =Utility.Bool2byte( chkTutuc.Checked ); objnewItems.NgayTao = DateTime.Now; objnewItems.QD31 = Utility.DoTrim(txtQD31.Text); objnewItems.NguoiTao = globalVariables.UserName; objnewItems.NuocSanxuat = Utility.sDbnull(txtNuocSX.Text); objnewItems.GioihanKedon = (Int16)Utility.DecimaltoDbnull(txtSoluong.Text,-1); objnewItems.DonviBut = (int)Utility.DecimaltoDbnull(txtBut.Text, -1); objnewItems.MaDonvitinh = txtDonvitinh.myCode; objnewItems.CoChiathuoc = Utility.Bool2byte(chkChiathuoc.Checked); objnewItems.MaDvichia = txtDonvichia.myCode; objnewItems.SluongChia =(int) Utility.DecimaltoDbnull(txtSoluongchia.Text, 0); objnewItems.DongiaChia = Utility.DecimaltoDbnull(txtDongiachia.Text, 0); objnewItems.TinhChat = Convert.ToByte(cboDrugNature.SelectedIndex); objnewItems.HoatChat = Utility.sDbnull(txtActice.Text); objnewItems.KieuThuocvattu = Utility.sDbnull(cboKIEU_THUOC_VT.SelectedValue); objnewItems.NoitruNgoaitru = optAll.Checked ? "ALL" : (optNoitru.Checked ? "NOI" : "NGOAI"); objnewItems.IsNew = true; objnewItems.Save(); int v_intNewDrugID = objnewItems.IdThuoc; txtID.Text = Utility.sDbnull(objnewItems.IdThuoc); DataRow dr = m_dtDrugDataSource.NewRow(); Utility.FromObjectToDatarow(objnewItems, ref dr); dr[DmucThuoc.Columns.TinhChat] = Convert.ToByte(cboDrugNature.SelectedIndex); dr["ten_loaithuoc"] = txtLoaithuoc.Text; dr["ten_donvitinh"] = txtDonvitinh.Text; dr["ten_donvichia"] = txtDonvichia.Text; dr[DmucThuoc.Columns.NguoiTao] = globalVariables.UserName; dr[DmucThuoc.Columns.NgayTao] = DateTime.Now; m_dtDrugDataSource.Rows.Add(dr); m_dtDrugDataSource.AcceptChanges(); m_enAction = action.Insert; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn try { Utility.GotoNewRowJanus(grdList, "id_thuoc", v_intNewDrugID.ToString().Trim()); if (chkThemlientuc.Checked) SetControlStatus(); else this.Close(); } catch (Exception exception) { } Utility.SetMsg(lblMsg, "Thêm mới dữ liệu thành công!",false); SetControlStatus(); txtCode.Focus(); } catch { } }
protected void bind_order_titles() { //get order number from querystrings Int32 _orderno = wwi_func.vint(wwi_security.DecryptString(get_token("pno"),"publiship")); //999909; //Request.QueryString["pid"] != null ? wwi_func.vint(Request.QueryString["pid"].ToString()) : 0; //query item table SubSonic.Query _q = new SubSonic.Query(DAL.Logistics.Tables.ItemTable, "WWIProv").WHERE("OrderNumber", Comparison.Equals, _orderno); DataSet _ds = _q.ExecuteDataSet(); this.dxgridTitles.KeyFieldName = "TitleID"; this.dxgridTitles.DataSource = _ds; this.dxgridTitles.DataBind(); }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { try { Utility.SetMsg(lblMsg, "", false); SqlQuery sqlQuery = new Select().From(DmucThuoc.Schema) .Where(DmucThuoc.Columns.MaThuoc).IsEqualTo(txtCode.Text); if (sqlQuery.GetRecordCount() > 0) { Utility.SetMsg(lblMsg, "Đã tồn tại thuốc có mã(Drug Code)=" + txtCode.Text.Trim() + ".Đề nghị bạn nhập mã khác",true); m_Query = DmucThuoc.CreateQuery(); return; } //Bước 0: Thêm mới thuốc DmucThuoc objThuoc = new DmucThuoc(); objThuoc.TenThuoc = Utility.sDbnull(txtName.Text); objThuoc.TenBhyt = Utility.sDbnull(txtTEN_BHYT.Text); objThuoc.MaThuoc = Utility.sDbnull(txtCode.Text); objThuoc.MaQD40 = Utility.sDbnull(txtMaQD40.Text); objThuoc.MaQDTinh = Utility.sDbnull(txtMaQDTinh.Text); objThuoc.SluongVuottran = (int)Utility.DecimaltoDbnull(txtSlVuottran.Text, 0); objThuoc.IdLoaithuoc = Utility.Int16Dbnull(txtLoaithuoc.MyID); objThuoc.DonGia = Utility.DecimaltoDbnull( txtDongia.Text, 0); objThuoc.GiaDv = Utility.DecimaltoDbnull(txtGiaDV.Text, 0); objThuoc.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0); objThuoc.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0); objThuoc.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0); objThuoc.MotaThem = Utility.sDbnull(txtDesc.Text); objThuoc.DangBaoche = Utility.DoTrim(txtDangBaoChe.Text); objThuoc.HamLuong = Utility.sDbnull(txtContent.Text); objThuoc.HangSanxuat = Utility.sDbnull(txtHangSX.Text); objThuoc.TrangThai = chkHieuLuc.Checked ? (byte)1 : (byte)0; objThuoc.TuTuc =Utility.Bool2byte( chkTutuc.Checked ); objThuoc.NgayTao = DateTime.Now; objThuoc.QD31 = Utility.DoTrim(txtQD31.Text); objThuoc.NguoiTao = globalVariables.UserName; objThuoc.NuocSanxuat = Utility.sDbnull(txtNuocSX.Text); objThuoc.GioihanKedon = (Int16)Utility.DecimaltoDbnull(txtSoluong.Text,-1); objThuoc.DonviBut = (int)Utility.DecimaltoDbnull(txtBut.Text, -1); objThuoc.MaDonvitinh = txtDonvitinh.myCode; objThuoc.CachSudung = txtCachsudung.myCode; objThuoc.NguonGoc = Utility.sDbnull(txtNguongoc.Text,""); objThuoc.CoChiathuoc = Utility.Bool2byte(chkChiathuoc.Checked); objThuoc.MaDvichia = txtDonvichia.myCode; objThuoc.SluongChia =(int) Utility.DecimaltoDbnull(txtSoluongchia.Text, 0); objThuoc.DongiaChia = Utility.DecimaltoDbnull(txtDongiachia.Text, 0); objThuoc.SingleService = Utility.Bool2byte(chkSingle.Checked); objThuoc.TinhChat = Convert.ToByte(cboDrugNature.SelectedIndex); objThuoc.HoatChat = Utility.sDbnull(txtActice.Text); objThuoc.KieuThuocvattu = txtKieuthuocVT.myCode; objThuoc.NoitruNgoaitru = optAll.Checked ? "ALL" : (optNoitru.Checked ? "NOI" : "NGOAI"); objThuoc.IsNew = true; dmucThuoc_busrule.Insert(objThuoc, GetQheCamchidinhChungphieuCollection()); int v_intNewDrugID = objThuoc.IdThuoc; txtID.Text = Utility.sDbnull(objThuoc.IdThuoc); DataRow dr = m_dtDrugDataSource.NewRow(); Utility.FromObjectToDatarow(objThuoc, ref dr); dr[DmucThuoc.Columns.TinhChat] = Convert.ToByte(cboDrugNature.SelectedIndex); dr["ten_loaithuoc"] = txtLoaithuoc.Text; dr["ten_donvitinh"] = txtDonvitinh.Text; dr["ten_donvichia"] = txtDonvichia.Text; dr["ten_cachsudung"] = txtCachsudung.Text; dr[DmucThuoc.Columns.NguoiTao] = globalVariables.UserName; dr[DmucThuoc.Columns.NgayTao] = DateTime.Now; m_dtDrugDataSource.Rows.Add(dr); txtName.AddNewItems(dr); m_dtDrugDataSource.AcceptChanges(); m_enAction = action.Insert; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn try { Utility.GotoNewRowJanus(grdList, "id_thuoc", v_intNewDrugID.ToString().Trim()); if (chkThemlientuc.Checked) SetControlStatus(); else this.Close(); } catch (Exception exception) { Utility.ShowMsg("Lỗi:"+ exception.Message); } Utility.SetMsg(lblMsg, "Thêm mới dữ liệu thành công!",false); SetControlStatus(); txtMaQD40.Focus(); } catch { } }
/// <summary> /// binding titles in child grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxgridTitles_BeforePerformDataSelect(object sender, EventArgs e) { try { ASPxGridView _detail = (ASPxGridView)sender; String[] _keys = { "DeliveryID" }; int _deliveryid = (int)_detail.GetMasterRowFieldValues(_keys); SubSonic.Query _q = new SubSonic.Query(DAL.Logistics.Tables.DeliverySubSubTable, "WWIProv").WHERE("DeliveryID", Comparison.Equals, _deliveryid); DataSet _ds = _q.ExecuteDataSet(); _detail.KeyFieldName = "SubDeliveryID"; _detail.DataSource = _ds; //DO NOT CALL DATABIND during BeforePerformDataSelect as it causes an infinite loop //_detail.DataBind(); //deprecated we are binding in code behind //this.odsDeliveryTitles.SelectParameters["DeliveryID"].DefaultValue = _deliveryid.ToString(); } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } //end try }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { Utility.SetMsg(lblMsg, "", false); //Gọi Business cập nhật dữ liệu Int16 v_intUpdateDrugID = Convert.ToInt16(txtID.Text); SqlQuery sqlQuery = new Select().From(DmucThuoc.Schema) .Where(DmucThuoc.Columns.MaThuoc).IsEqualTo(txtCode.Text) .And(DmucThuoc.Columns.IdThuoc).IsNotEqualTo(v_intUpdateDrugID); //Kiểm tra nếu trùng Mã Drug Code thì bắt nhập mã khác //DmucThuocCollection v_arrSameCodeObject = new DmucThuocController().FetchByQuery(m_Query.AddWhere("Drug_Code", txtCode.Text.Trim().ToUpper()).AND("id_thuoc", Comparison.NotEquals, v_intUpdateDrugID)); if (sqlQuery.GetRecordCount() > 0) { Utility.SetMsg(lblMsg, "Đã tồn tại thuốc có mã =" + txtCode.Text.Trim() + ".Đề nghị bạn nhập mã khác",true); m_Query = DmucThuoc.CreateQuery(); return; } //Create Again to ignore Where Clause m_Query = DmucThuoc.CreateQuery(); //Tạo giá trị mới cho đối tượng đang cần Update DmucThuoc objThuoc = DmucThuoc.FetchByID(txtID.Text); objThuoc.MaThuoc = Utility.sDbnull(txtCode.Text); objThuoc.MaQD40 = Utility.sDbnull(txtMaQD40.Text); objThuoc.MaQDTinh = Utility.sDbnull(txtMaQDTinh.Text); objThuoc.SluongVuottran = (int)Utility.DecimaltoDbnull(txtSlVuottran.Text, 0); objThuoc.TenThuoc = Utility.GetValue(txtName.Text, false); objThuoc.TenBhyt = Utility.GetValue(txtTEN_BHYT.Text, false); objThuoc.DonGia = Utility.DecimaltoDbnull( txtDongia.Text,0); objThuoc.GiaDv = Utility.DecimaltoDbnull(txtGiaDV.Text, 0); objThuoc.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0); objThuoc.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0); objThuoc.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0); objThuoc.MaThuoc = Utility.GetValue(txtCode.Text, false); objThuoc.IdLoaithuoc = Convert.ToInt16(txtLoaithuoc.MyID); objThuoc.TinhChat = Convert.ToByte(cboDrugNature.SelectedIndex); objThuoc.MaDonvitinh = txtDonvitinh.myCode; objThuoc.TuTuc = Utility.Bool2byte(chkTutuc.Checked); objThuoc.MotaThem = Utility.GetValue(txtDesc.Text, false); objThuoc.HoatChat = Utility.GetValue(txtActice.Text, false); objThuoc.NuocSanxuat = txtNuocSX.Text; objThuoc.HangSanxuat = txtHangSX.Text; objThuoc.HamLuong = txtContent.Text; objThuoc.QD31 = Utility.DoTrim(txtQD31.Text); objThuoc.SoDangky = txtNumber_Register.Text; objThuoc.TrangThai = chkHieuLuc.Checked ? (byte)1 : (byte)0; objThuoc.DangBaoche = Utility.DoTrim(txtDangBaoChe.Text); objThuoc.NguoiSua = globalVariables.UserName; objThuoc.NgaySua = DateTime.Now; objThuoc.GioihanKedon = (Int16)Utility.DecimaltoDbnull(txtSoluong.Text, -1); objThuoc.DonviBut = (int)Utility.DecimaltoDbnull(txtBut.Text, -1); objThuoc.CachSudung = txtCachsudung.myCode; objThuoc.SingleService = Utility.Bool2byte(chkSingle.Checked); objThuoc.CoChiathuoc = Utility.Bool2byte(chkChiathuoc.Checked); objThuoc.MaDvichia = txtDonvichia.myCode; objThuoc.SluongChia = (int)Utility.DecimaltoDbnull(txtSoluongchia.Text, 0); objThuoc.DongiaChia = Utility.DecimaltoDbnull(txtDongiachia.Text, 0); objThuoc.NguonGoc = Utility.sDbnull(txtNguongoc.Text, ""); objThuoc.NoitruNgoaitru=optAll.Checked?"ALL":(optNoitru.Checked?"NOI":"NGOAI"); objThuoc.KieuThuocvattu = txtKieuthuocVT.myCode; objThuoc.IsNew = false; objThuoc.MarkOld(); dmucThuoc_busrule.Insert(objThuoc, GetQheCamchidinhChungphieuCollection()); //Update to Datasource to reflect on DataGridView DataRow dr = Utility.FetchOnebyCondition(m_dtDrugDataSource, "id_thuoc=" + v_intUpdateDrugID.ToString().Trim()); if (dr != null) { Utility.FromObjectToDatarow(objThuoc, ref dr); dr[DmucThuoc.Columns.TinhChat] = Convert.ToByte(cboDrugNature.SelectedIndex); dr["ten_loaithuoc"] = txtLoaithuoc.Text; dr["ten_donvitinh"] = txtDonvitinh.Text; dr["ten_donvichia"] = txtDonvichia.Text; dr["ten_cachsudung"] = txtCachsudung.Text; dr[DmucThuoc.Columns.HamLuong] = txtContent.Text; dr[DmucThuoc.Columns.SoDangky] = txtNumber_Register.Text; dr[DmucThuoc.Columns.NuocSanxuat] = txtNuocSX.Text; dr[DmucThuoc.Columns.HangSanxuat] = txtHangSX.Text; txtName.UpdateItems(dr); m_dtDrugDataSource.AcceptChanges(); } //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn if (grdList != null) Utility.GotoNewRowJanus(grdList, "id_thuoc", txtID.Text.Trim()); SetControlStatus(); Utility.SetMsg(lblMsg, "Cập nhật dữ liệu thành công.", false); this.Close(); }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { //Kiểm tra trùng tên bệnh viện và cảnh báo DmucBenhvienCollection v_arrSameNameObject = new DmucBenhvienController().FetchByQuery(m_Query.AddWhere(DmucBenhvien.Columns.TenBenhvien,txtName.Text.Trim().ToUpper())); if (v_arrSameNameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có bệnh viện có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause txtName.Focus(); m_Query = DmucBenhvien.CreateQuery(); return; } } //Create Again to ignore Where Clause m_Query = DmucBenhvien.CreateQuery(); // Lấy về MaxID vừa được thêm vào CSDL int actionResult = CreateHospital(); if (actionResult > 0) { ProcessData(actionResult); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, DmucBenhvien.Columns.IdBenhvien, actionResult.ToString()); Utility.ShowMsg("Thêm mới dữ liệu thành công!"); SetControlStatus(); this.Activate(); } else//Có lỗi xảy ra Utility.ShowMsg("Thêm mới không thành công. Mời bạn xem lại"); }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { //Create Again to ignore Where Clause m_Query = DmucBenhvien.CreateQuery(); //Gọi Business cập nhật dữ liệu int v_intObjectTypeID = Convert.ToInt32(txtID.Text); //Kiểm tra trùng tên bệnh viện và cảnh báo DmucBenhvienCollection v_arrSameNameObject = new DmucBenhvienController() .FetchByQuery(m_Query.AddWhere(DmucBenhvien.Columns.TenBenhvien,Comparison.Equals, txtName.Text.Trim().ToUpper()) .AND(DmucBenhvien.Columns.IdBenhvien, Comparison.NotEquals, v_intObjectTypeID)); if (v_arrSameNameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có bệnh viện có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) return; } int actionResult = CreateHospital(); if (actionResult >-1) { m_DataSource.Sort(DmucBenhvien.Columns.SttHthi, true); ProcessData1(); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList,DmucBenhvien.Columns.IdBenhvien, txtID.Text.Trim()); SetControlStatus(); Utility.ShowMsg("Cập nhật dữ liệu thành công."); }else { Utility.ShowMsg("Bạn gặp lỗi trong quá trình cập nhập", "Thông báo"); return; } }
/// <summary> /// Thực hiện nghiệp vụ Insert dữ liệu /// </summary> private void PerformInsertAction() { Utility.SetMsg(lblMsg, "", true); //Kiểm tra trùng tên đối tượng và cảnh báo DmucLoaithuocCollection v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ma_loaithuoc", txtDrug_Code.Text.Trim().ToUpper())); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm thuốc có mã:" + txtDrug_Code.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); txtDrug_Code.Focus(); return; } } v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ten_loaithuoc", txtName.Text.Trim().ToUpper())); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); txtName.Focus(); return; } } //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); //Gọi nghiệp vụ Insert dữ liệu DmucLoaithuoc objDrugType = new DmucLoaithuoc(); objDrugType.MaLoaithuoc = Utility.sDbnull(txtDrug_Code.Text); objDrugType.TenLoaithuoc = Utility.sDbnull(txtName.Text); objDrugType.MotaThem = Utility.sDbnull(txtDesc.Text); objDrugType.MaNhomthuoc = Utility.sDbnull(txtNhom.myCode, ""); objDrugType.SttHthi = Convert.ToInt16(txtPos.Text); objDrugType.InRieng = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); objDrugType.KieuThuocvattu = txtNhom.myCode;; objDrugType.IsNew = true; objDrugType.Save(); //Lấy về MaxID vừa được thêm vào CSDL int v_shtIdLoaithuoc = objDrugType.IdLoaithuoc; //Lấy về Object vừa tạo DmucLoaithuocCollection v_arrNewObject = new DmucLoaithuocController().FetchByID(v_shtIdLoaithuoc); if (v_arrNewObject.Count > 0)//-->Thêm mới thành công { DataRow newitem = m_dtLoaithuoc.NewRow(); Utility.FromObjectToDatarow(v_arrNewObject[0], ref newitem); newitem["ten_nhomthuoc"] = txtNhom.Text; m_dtLoaithuoc.Rows.Add(newitem); //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, "Id_Loaithuoc", v_shtIdLoaithuoc.ToString()); Utility.SetMsg(lblMsg, "Thêm mới dữ liệu thành công!", false); SetControlStatus(); this.Activate(); } else//Có lỗi xảy ra { Utility.SetMsg(lblMsg, "Thêm mới không thành công. Mời bạn xem lại", false); } }
/// <summary> /// Thực hiện nghiệp vụ Update dữ liệu /// </summary> private void PerformUpdateAction() { Utility.SetMsg(lblMsg, "", true); //Gọi Business cập nhật dữ liệu int v_shtIdLoaithuoc = Convert.ToInt32(txtID.Text); //Kiểm tra trùng tên đối tượng và cảnh báo DmucLoaithuocCollection v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ma_loaithuoc", txtDrug_Code.Text.Trim().ToUpper()).AND("Id_Loaithuoc", Comparison.NotEquals, v_shtIdLoaithuoc)); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm có mã:" + txtDrug_Code.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); return; } } v_arrSameObject = new DmucLoaithuocController().FetchByQuery(m_Query.AddWhere("ten_loaithuoc", txtName.Text.Trim().ToUpper()).AND("Id_Loaithuoc", Comparison.NotEquals, v_shtIdLoaithuoc)); if (v_arrSameObject.Count > 0) { if (!Utility.AcceptQuestion("Đã có nhóm có tên:" + txtName.Text.Trim() + ". Bạn có muốn tiếp tục ghi hay không?", "Cảnh báo", true)) { //Create Again to ignore Where Clause m_Query = DmucDoituongkcb.CreateQuery(); return; } } //Create Again to ignore Where Clause m_Query = DmucLoaithuoc.CreateQuery(); DmucLoaithuoc v_NewObjectChangePos = null; DmucLoaithuoc objDrugType = DmucLoaithuoc.FetchByID(Convert.ToInt16(txtID.Text)); if (objDrugType != null) { objDrugType.MaLoaithuoc = Utility.sDbnull(txtDrug_Code.Text); objDrugType.TenLoaithuoc = Utility.sDbnull(txtName.Text); objDrugType.MotaThem = Utility.sDbnull(txtDesc.Text); objDrugType.MaNhomthuoc = Utility.sDbnull(txtNhom.myCode, ""); objDrugType.SttHthi = Convert.ToInt16(txtPos.Text); objDrugType.InRieng = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); objDrugType.KieuThuocvattu = txtKieuthuocVT.myCode; objDrugType.IsNew = false; objDrugType.MarkOld(); objDrugType.Save(); } DataRow[] arrDr = m_dtLoaithuoc.Select(DmucLoaithuoc.Columns.IdLoaithuoc + "=" + txtID.Text); if (arrDr.Length > 0) { arrDr[0][DmucLoaithuoc.Columns.MaLoaithuoc] = Utility.sDbnull(txtDrug_Code.Text); arrDr[0][DmucLoaithuoc.Columns.TenLoaithuoc] = Utility.sDbnull(txtName.Text); arrDr[0][DmucLoaithuoc.Columns.MotaThem] = Utility.sDbnull(txtDesc.Text); arrDr[0][DmucLoaithuoc.Columns.MaNhomthuoc] = Utility.sDbnull(txtNhom.myCode, ""); arrDr[0][DmucLoaithuoc.Columns.SttHthi] = Convert.ToInt16(txtPos.Text); arrDr[0][DmucLoaithuoc.Columns.InRieng] = Convert.ToInt16(chkInrieng.Checked ? 1 : 0); arrDr[0][DmucLoaithuoc.Columns.KieuThuocvattu] = txtKieuthuocVT.myCode; arrDr[0]["ten_nhomthuoc"] = txtNhom.Text; } //Return to the InitialStatus m_enAction = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRowJanus(grdList, "Id_Loaithuoc", txtID.Text.Trim()); SetControlStatus(); Utility.SetMsg(lblMsg, "Cập nhật dữ liệu thành công.", false); }
//end bind summary protected void bind_deliveries() { try { int _orderno = wwi_func.vint(wwi_security.DecryptString(get_token("pno"), "publiship")); //query delivefries table SubSonic.Query _q = new SubSonic.Query(DAL.Logistics.Tables.DeliverySubTable, "WWIProv").WHERE("OrderNumber", Comparison.Equals, _orderno); DataSet _ds = _q.ExecuteDataSet(); this.dxgridDeliveries.KeyFieldName = "DeliveryID"; this.dxgridDeliveries.DataSource = _ds; this.dxgridDeliveries.DataBind(); } catch (Exception ex) { string _ex = ex.Message.ToString(); this.dxlblErr.Text = _ex; this.dxpnlErr.ClientVisible = true; } }