LỆNH CẦN BIẾT
1. câu lệnh set và gọi link help web
// Some code
// set đường dẫn. copy paste đường dẫn vào ""
myform.LinkHelp = "https://huongdanketoan.dtechvn.com/";
// gọi web theo đường dẫn phía trên
myform.Help();
//return;
#region: Tạo code gọi link
string sLink = "https://0100108818.dtechvn.com/phan-mem-kho/po/giao-dien-xem-truoc";
myform.LinkHelp = sLink;
myform.Help();
#endregion: Tạo code gọi link
2. Chuyển xâu format thành list và remove giá trị trống
// xau = ",1,2,3,,," => [1,2,3]
// chuyển thành list và remove giá trị trống nếu có
string sChuoi = "1,2,3,,,,";
List<string> lstChuoi = sChuoi.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
3. Câu lệnh sql gọi từ server1 sang server2
// Some code
//select * from OPENDATASOURCE('SQLOLEDB','@thongtinDangnhap').@databaseName.dbo.@tableName
@thongtinDangnhap= 'SERVER=DTECH\SQL2017,1688;User id=sa; PASSWORD=xxxx'
4. Tạo form nhập biến dữ liệu
// Some code
DataRow GetMoreValues(Size _size, string title, int ColumnNumber, out bool confirm, string option, params string[] from)
//
DateTime ngay0 = DateTime.Now;
DateTime tungay = myform.dauthang(ngay0.Month, ngay0.Year);
DateTime denngay = myform.cuoithang(ngay0.Month, ngay0.Year);
DateTime drTungay = new DateTime(1900, 1, 1);
DateTime drDenngay = new DateTime(1900, 1, 1);
string sWhere = "", drTaikhoan = "", drSotien = "", drTkKhNo = "", drTkKhCo = "";
int drKhachhang = 0;
DataRow dr;
// biến xem là người dùng bấm xác nhận "có hoặc không"
bool confirm = false;
// A-danhmuc, F-Fromlist,D-ngay,N-numeric,C-text
// muốn khai báo form nhập kiểu nào thì khai báo tuần tự
string option = "AADDNAAFC"
// par là biến theo option. gán kiểu tương ứng option
string[] par = new string[option.Length];
par[0] = "Đối tượng #80#300#khachhang,khachhang,ten#0"; //A
// A - chỉ hiển thị được msthue.
// khi lấy thì lấy id (khachhang.khachang) thay vì khachhang.msthue
par[0] = "Đối tượng #80#300#khachhang,khachhang,msthue#0";
par[1] = "Tài khoản #80#160#taikhoan,ma,ma#1311"; //A
par[2] = "Từ ngày #10#" + tungay.ToString("dd/MM/yyyy"); // D
par[3] = "Đến ngày #10#" + denngay.ToString("dd/MM/yyyy"); //D
par[4] = "Số tiền xử lý <= #20#" + _Vari.dpPsNo.ToString()+"#1000"; //N
par[5] = "Tài khoản Ghi nợ #80#160#taikhoan,ma,ma#8118"; // A dm tài khoản
par[6] = "Tài khoản Ghi có #80#160#taikhoan,ma,ma#7118"; // A Dm tài khoản
C.par[0] = "Lý do hủy PO: #80#300##"; // C
Fromlist.par[7] = "Số kỳ phân tích#200#200#1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12#1"; // F Dạng fromlist
dr = _Func.GetFormValues(new Size(300, 300), "Nhập thông tin xử lý", 1, out confirm, option, par);
if(dr != null && confirm)
{
// xử lý
}
Last updated