Beispiel #1
0
 public static bool ThemTrangThaiDuyet(ABTrangThaiDuyet trangthai)
 {
     try
     {
         db.ABTrangThaiDuyets.InsertOnSubmit(trangthai);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 public static bool InsertAbill(abill bill)
 {
     try
     {
         db.abills.InsertOnSubmit(bill);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #3
0
 public static bool ThemBoPhan(BDepartment pdepartment)
 {
     try
     {
         db.BDepartments.InsertOnSubmit(pdepartment);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
 public static bool ThemChucVu(ChucVu pchucvu)
 {
     try
     {
         db.ChucVus.InsertOnSubmit(pchucvu);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #5
0
 public static bool ThemDuLieu(ABJobAgent pnghiphep)
 {
     try
     {
         db.ABJobAgents.InsertOnSubmit(pnghiphep);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #6
0
 public static bool ThemPDNSheetFlow(PDNSheetFlow pchitiet)
 {
     try
     {
         db.ChiTietBuocKies.InsertOnSubmit(pchitiet);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #7
0
 public static bool ThemVatTu(BOfSupply pvattu)
 {
     try
     {
         db.BOfSupplies.InsertOnSubmit(pvattu);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #8
0
 public static bool InsertFile(PDNLink pdn)
 {
     try
     {
         db.PDNLinks.InsertOnSubmit(pdn);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public static bool ThemChiTietMuaHang(pdna1 chitiet)
 {
     try
     {
         db.pdna1s.InsertOnSubmit(chitiet);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #10
0
 public static bool ThemCanBoDonVi(CanBoDonVi pcanbo)
 {
     try
     {
         db.CanBoDonVis.InsertOnSubmit(pcanbo);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #11
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            DropDownList DropCty    = GridView1.Rows[e.RowIndex].Cells[1].Controls[0] as DropDownList;
            DropDownList DropBoPhan = GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as DropDownList;
            //TextBox txtMaNV = GridView1.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox;
            TextBox txtTenNV = GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox;
            TextBox txtChuKy = GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox;
            string  MaNV     = (string)GridView1.DataKeys[e.RowIndex].Value;

            Busers2 user = db.Busers2s.Where(p => p.USERID == MaNV).FirstOrDefault();

            user.USERID   = MaNV;
            user.USERNAME = txtTenNV.Text;
            user.GSBH     = DropCty.Text;
            user.BADEPID  = DropBoPhan.Text;
            // user.signatue = txtChuKy.Text;
            db.SubmitChanges();
            GridView1.EditIndex = -1;
            HienThiDanhSach();
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("~/presentationLayer/DangNhap.aspx");
            }
            string   str        = Request.QueryString.Get("IDQuyTrinh");
            int      idquytrinh = int.Parse(str);
            QPDNFlow quytrinh   = db.QPDNFlows.Where(p => p.IDQuyTrinh == idquytrinh).FirstOrDefault();

            db.QPDNFlows.DeleteOnSubmit(quytrinh);
            db.SubmitChanges();
            Response.Redirect("FQPDNFlow.aspx");
        }
        public void CapNhatPhieu(pdna phieuchuadich)
        {
            iOfficeDataContext con = new iOfficeDataContext();
            pdna tim = pnaDAO.TimVanBanTheoMa(phieuchuadich.pdno, phieuchuadich.GSBH, true);

            if (tim == null)
            {
                con.pdnas.InsertOnSubmit(phieuchuadich);
            }
            else
            {
                con.pdnas.Attach(phieuchuadich, true);
            }
            db.SubmitChanges();
        }
Beispiel #14
0
 public static bool CapNhatID(string pUserID, int pSystemID, string pSessionID)
 {
     try
     {
         Users_System user = new Users_System();
         user.SystemID  = pSystemID;
         user.UserID    = pUserID;
         user.SessionID = pSessionID;
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #15
0
 public static bool InsertUser(Busers2 user)
 {
     try
     {
         db.Busers2s.InsertOnSubmit(user);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #16
0
 public static bool ThemQuyTrinh(QPDNFlow pquytrinh)
 {
     try
     {
         db.QPDNFlows.InsertOnSubmit(pquytrinh);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox buocky = GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox;
            TextBox nhom   = GridView1.Rows[e.RowIndex].Cells[6].Controls[0] as TextBox;
            TextBox maloai = GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox;
            //TextBox kytoanbo = GridView1.Rows[e.RowIndex].Cells[7].Controls[0] as TextBox;
            int    id     = int.Parse(GridView1.DataKeys[e.RowIndex]["IDChiTiet"].ToString());
            int    buoc   = int.Parse(buocky.Text);
            string loai   = maloai.Text.ToString();
            int    nhomky = int.Parse(nhom.Text);
            // bool ky = bool.Parse(kytoanbo.Text);
            ChiTietLoaiKy chitiet = db.ChiTietLoaiKies.Where(p => p.IDChiTiet == id).FirstOrDefault();

            chitiet.IDChiTiet = id;
            chitiet.abstep    = buoc;
            chitiet.abtype    = loai;
            chitiet.Nhom      = nhomky;
            //chitiet.KyToanBo = ky;
            db.SubmitChanges();
            GridView1.EditIndex = -1;
            HienThiDanhSach();
        }
        protected void btnKhoiPhuc_Click(object sender, EventArgs e)
        {
            string   maphieu     = Session["maphieu"].ToString();
            string   macongty    = Session["congty"].ToString();
            string   manguoidung = Session["user"].ToString();
            DateTime date        = DateTime.Now;
            //string ngaytao = DateTime.Parse(date.ToShortDateString()).ToString("dd/MM/yyyy");
            //List<Abcon> DSphieu = AbconDAO.QryChiTietPhieuTheoPhieuKhongDuocDuyet(maphieu, macongty, manguoidung);
            //foreach (Abcon phieu in DSphieu)
            //{
            //    AbconDAO.XoaChiTietTheoSoPhieu(phieu.IDCT);
            //}
            //List<VanBanDen> DsVanBanden = VanBanDenDAO.QryVanBanDen(maphieu, macongty);
            //foreach (VanBanDen vanban in DsVanBanden)
            //{
            //    VanBanDenDAO.XoaVanBanDen(vanban.id);
            //}
            //List<PDNSheetFlow> DsChitiet = PDNSheetFlowDAO.QryPDNSheetFlowTheoPhieu(maphieu, macongty);
            //foreach (PDNSheetFlow chitiet in DsChitiet)
            //{
            //    PDNSheetFlowDAO.XoaPDNSheetFlow(chitiet.Id);
            //}
            //ABTrangThaiDuyet trangthai = TrangThaiDuyetDAO.TimKiemMaVanTheoTrangThaiDuyet(maphieu, macongty);

            //    TrangThaiDuyetDAO.XoaTrangThaiDuyet(trangthai.IDTrangThai);
            //string dem = (pdnaBUS.DemSoLuongVanBan() + 1).ToString();
            //string maphieumoi = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMMdd") + "00" + dem;
            string    maphieumoi = "";
            dalPDN    dal        = new dalPDN();
            DataTable dt         = dal.DemSoLuongPhieu();
            string    aa         = dt.Rows[0]["pdno"].ToString().Trim();

            if (dt.Rows.Count != 0 && aa != "")
            {
                string dem = (int.Parse(aa) + 1).ToString();
                maphieumoi = dem;
            }
            else
            {
                maphieumoi = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
            }
            pdna timphieu = pnaDAO.TimVanBanTheoMa(maphieu, macongty, true);

            db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.ExecuteQuery <pdna>("select * from pdna where pdno='" + timphieu.pdno.ToString() + "'and GSBH='" + timphieu.GSBH.ToString() + "' and CFMID0='" + timphieu.CFMID0.ToString() + "'"));
            pdna phieub = new pdna();

            phieub.pdno          = maphieumoi;
            phieub.YN            = 5;
            phieub.GSBH          = macongty;
            phieub.dagui         = false;
            phieub.bixoa         = false;
            phieub.CFMDate0      = DateTime.Today;
            phieub.CFMDate1      = null;
            phieub.CFMDate2      = null;
            phieub.CFMDate4      = null;
            phieub.IdnguoiDich   = null;
            phieub.trangthaidich = false;
            phieub.NoiDungDich   = null;
            phieub.LevelDoing    = 1;
            phieub.CFMID0        = manguoidung;
            phieub.Abtype        = timphieu.Abtype;

            phieub.mytitle  = timphieu.mytitle;
            phieub.pddepid  = timphieu.pddepid;
            phieub.pdmemovn = timphieu.pdmemovn;
            phieub.oldpdno  = timphieu.pdno;
            phieub.ABC      = 1;
            //pnaDAO.CapNhatPhieuBiHuy(phieub);
            //db.ExecuteCommand("update pdna set GSBH='" + phieub.GSBH.ToString() + "',NoiDungDich=N'" + phieub.NoiDungDich.ToString() + "',CFMDate1='" + phieub.CFMDate1 + "',trangthaidich='" + phieub.trangthaidich.Value + "',CFMDate0=N'" + phieub.CFMDate0 + "',CFMDate2=N'" + phieub.CFMDate2 + "',bixoa='" + phieub.bixoa.Value + "',dagui='" + phieub.dagui.Value + "',YN='" + int.Parse(phieub.YN.ToString()) + "',LevelDoing='" + int.Parse(phieub.LevelDoing.ToString()) + "',IdnguoiDich=N'" + phieub.IdnguoiDich.ToString() + "' where pdno=N'" + phieub.pdno.ToString() + "' ");
            // db.ExecuteCommand("update pdna set GSBH='" + phieub.GSBH.ToString() + "',NoiDungDich=N'" + phieub.NoiDungDich.ToString() + "',trangthaidich='" + phieub.trangthaidich.Value + "',CFMDate0=N'" + phieub.CFMDate0 + "',bixoa='" + phieub.bixoa.Value + "',dagui='" + phieub.dagui.Value + "',YN='" + int.Parse(phieub.YN.ToString()) + "',LevelDoing='" + int.Parse(phieub.LevelDoing.ToString()) + "',IdnguoiDich=N'" + phieub.IdnguoiDich.ToString() + "' where pdno=N'" + phieub.pdno.ToString() + "' ");
            // db.CapNhatPhieuDaBiHuy(phieub.pdno, phieub.GSBH, phieub.dagui, phieub.bixoa, phieub.YN, phieub.NoiDungDich, phieub.IdnguoiDich, phieub.trangthaidich, phieub.CFMDate1, phieub.CFMDate0, phieub.CFMDate2, phieub.CFMDate4, phieub.ABC, phieub.LevelDoing);
            // pnaDAO.InsertPDNA(phieub);
            db.pdnas.InsertOnSubmit(phieub);
            db.SubmitChanges();
            Response.Redirect("DanhsachphieumoikhoitaoNV.aspx");
        }
Beispiel #19
0
        protected void btnLuuTam_Click(object sender, EventArgs e)
        {
            string ngonngu = Session["languege"].ToString();
            string dem     = (pdnaBUS.DemSoLuongVanBan() + 1).ToString();
            string maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMMdd") + dem;
            string bophan  = DropDonVi.SelectedItem.Value.ToString();
            string bp      = DropDonVi.SelectedItem.Text;
            string congty  = Session["congty"].ToString();
            string tieude  = txtTieuDe.Text;
            string noidung = CKEditorControl1.Text;

            string loaiP      = DropLoaiPhieu.SelectedItem.Text;
            string macongty   = Session["congty"].ToString();
            string user       = Session["user"].ToString();
            string ngaythang  = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy");
            string ngaythang1 = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("Ngày " + "dd" + "Tháng " + "MM" + "Năm" + "yyyy");
            //string idphieu = Session["maphieu"].ToString();
            string loaiphieu = DropLoaiPhieu.SelectedValue.ToString();

            if (loaiphieu != "PDN2")
            {
                Busers2 timnguoitao = UserDAO.TimNhanVienTheoMa(user, congty);
                if (timnguoitao.IDCapDuyet >= 12)
                {
                    string      mabophan = "CBCC";
                    Busers2     us       = UserBUS.TimMaNhanVienTheoBoPhan(user, mabophan, macongty);
                    BDepartment bd       = BDepartmentDAO.TimMaDonVi(mabophan, macongty);
                    if (us == null)
                    {
                        Busers2 kiemtra = UserDAO.TimNhanVienQuanLyDonVi(user, bophan, macongty);
                        if (kiemtra == null)
                        {
                            if (ngonngu == "lbl_VN")
                            {
                                lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bd.DepName;
                            }
                            else if (ngonngu == "lbl_TW")
                            {
                                lbthongbao.Text = "该用户不属于部门 " + bd.DepName;
                            }
                            else if (ngonngu == "lbl_EN")
                            {
                                lbthongbao.Text = "The user does not belong to the department" + bd.DepName;
                            }
                        }
                        else
                        {
                            pdna phieun = new pdna();
                            {
                                phieun.pdno = maphieu;

                                phieun.GSBH     = macongty;
                                phieun.pdno     = maphieu;
                                phieun.Abtype   = loaiphieu;
                                phieun.pddepid  = bophan;
                                phieun.mytitle  = tieude;
                                phieun.pdmemovn = noidung;
                                phieun.CFMDate0 = DateTime.Today;
                                phieun.CFMID0   = user;
                                phieun.USERID   = user;
                                phieun.dagui    = false;
                                phieun.bixoa    = false;
                            }
                            db.pdnas.InsertOnSubmit(phieun);
                            db.SubmitChanges();

                            Session["loaiP"]     = loaiP;
                            Session["loaiphieu"] = loaiphieu;
                            Session["maphieu"]   = maphieu;
                            Session["bp"]        = bophan;
                            Session["bophan"]    = bp;
                            Session["noidung"]   = noidung;
                            Session["ngaytao"]   = ngaythang;
                            Session["tieude"]    = tieude;

                            Response.Redirect("Danhsachphieumoikhoitao.aspx");
                        }
                        Busers2 usertao = UserBUS.TimNhanVienTheoMa(user, macongty);
                        if (usertao != null && usertao.IDCapDuyet > 12)
                        {
                            Response.Redirect("FrmViewCB.aspx");
                        }
                        else
                        {
                            if (ngonngu == "lbl_VN")
                            {
                                lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bp;
                            }
                            else if (ngonngu == "lbl_TW")
                            {
                                lbthongbao.Text = "该用户不属于部门 " + bp;
                            }
                            else if (ngonngu == "lbl_EN")
                            {
                                lbthongbao.Text = "The user does not belong to the department" + bp;
                            }
                        }
                    }
                    else
                    {
                        pdna phieun = new pdna();
                        {
                            phieun.GSBH     = congty;
                            phieun.pdno     = maphieu;
                            phieun.pddepid  = mabophan;
                            phieun.mytitle  = tieude;
                            phieun.pdmemovn = noidung;
                            phieun.CFMDate0 = DateTime.Parse(ngaythang);
                            phieun.USERID   = user;
                            phieun.Abtype   = DropLoaiPhieu.SelectedValue;
                            phieun.bixoa    = false;
                            phieun.CFMID0   = user;
                            phieun.YN       = 5;
                            phieun.USERDATE = DateTime.Parse(ngaythang);
                        }
                        db.pdnas.InsertOnSubmit(phieun);
                        db.SubmitChanges();

                        Session["loaiP"]     = loaiP;
                        Session["loaiphieu"] = loaiphieu;
                        Session["maphieu"]   = maphieu;
                        Session["bp"]        = bophan;
                        Session["bophan"]    = bp;
                        Session["noidung"]   = noidung;
                        Session["ngaytao"]   = ngaythang;
                        Session["tieude"]    = tieude;

                        Response.Redirect("Danhsachphieumoikhoitao.aspx");
                    }
                }// cap chu quan 7 don vi tro len
                else
                {
                    BDepartment bd = BDepartmentDAO.TimMaDonVi(bophan, macongty);
                    Busers2     us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, macongty);
                    if (us == null)
                    {
                        Busers2 kiemtra = UserDAO.TimNhanVienQuanLyDonVi(user, bophan, macongty);
                        if (kiemtra == null)
                        {
                            if (ngonngu == "lbl_VN")
                            {
                                lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bd.DepName;
                            }
                            else if (ngonngu == "lbl_TW")
                            {
                                lbthongbao.Text = "该用户不属于部门 " + bd.DepName;
                            }
                            else if (ngonngu == "lbl_EN")
                            {
                                lbthongbao.Text = "The user does not belong to the department" + bd.DepName;
                            }
                        }
                        else
                        {
                            pdna phieun = new pdna();
                            {
                                phieun.pdno = maphieu;

                                phieun.GSBH     = macongty;
                                phieun.pdno     = maphieu;
                                phieun.Abtype   = loaiphieu;
                                phieun.pddepid  = bophan;
                                phieun.mytitle  = tieude;
                                phieun.pdmemovn = noidung;
                                phieun.CFMDate0 = DateTime.Parse(ngaythang);
                                phieun.CFMID0   = user;
                                phieun.USERID   = user;
                                phieun.dagui    = false;
                                phieun.bixoa    = false;
                            }
                            db.pdnas.InsertOnSubmit(phieun);
                            db.SubmitChanges();

                            Session["loaiP"]     = loaiP;
                            Session["loaiphieu"] = loaiphieu;
                            Session["maphieu"]   = maphieu;
                            Session["bp"]        = bophan;
                            Session["bophan"]    = bp;
                            Session["noidung"]   = noidung;
                            Session["ngaytao"]   = ngaythang;
                            Session["tieude"]    = tieude;

                            Response.Redirect("Danhsachphieumoikhoitao.aspx");
                        }
                        Busers2 usertao = UserBUS.TimNhanVienTheoMa(user, macongty);
                        if (usertao != null && usertao.IDCapDuyet > 12)
                        {
                            Response.Redirect("Danhsachphieumoikhoitao.aspx");
                        }
                        else
                        {
                            if (ngonngu == "lbl_VN")
                            {
                                lbthongbao.Text = "Người dùng này không thuộc bộ phận " + bp;
                            }
                            else if (ngonngu == "lbl_TW")
                            {
                                lbthongbao.Text = "该用户不属于部门 " + bp;
                            }
                            else if (ngonngu == "lbl_EN")
                            {
                                lbthongbao.Text = "The user does not belong to the department" + bp;
                            }
                        }
                    }
                    else
                    {
                        pdna phieun = new pdna();
                        {
                            phieun.GSBH     = congty;
                            phieun.pdno     = maphieu;
                            phieun.pddepid  = bophan;
                            phieun.mytitle  = tieude;
                            phieun.pdmemovn = noidung;
                            phieun.CFMDate0 = DateTime.Parse(ngaythang);
                            phieun.USERID   = user;
                            phieun.Abtype   = DropLoaiPhieu.SelectedValue;
                            phieun.bixoa    = false;
                            phieun.CFMID0   = user;
                            phieun.YN       = 5;
                            phieun.USERDATE = DateTime.Parse(ngaythang);
                        }
                        db.pdnas.InsertOnSubmit(phieun);
                        db.SubmitChanges();

                        Session["loaiP"]     = loaiP;
                        Session["loaiphieu"] = loaiphieu;
                        Session["maphieu"]   = maphieu;
                        Session["bp"]        = bophan;
                        Session["bophan"]    = bp;
                        Session["noidung"]   = noidung;
                        Session["ngaytao"]   = ngaythang;
                        Session["tieude"]    = tieude;

                        Response.Redirect("Danhsachphieumoikhoitao.aspx");
                    }
                }
            }
            else
            {
                Response.Redirect("Danhsachphieumoikhoitao.aspx");
            }
        }
Beispiel #20
0
 public static bool InsertPDNA(pdna pd)
 {
     try
     {
         db.pdnas.InsertOnSubmit(pd);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #21
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            string match = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
            //string ngonngu = Session["languege"].ToString();
            // string macongty = Session["congty"].ToString();
            string macongty      = "LTY";
            string idnguoidung   = txtMaNV.Text;
            string hoten         = txtTenNV.Text;
            string matkhau       = txtmatkhau.Text;
            string matkhau2      = txtmatkhau2.Text;
            string nguoiquanlyTT = txtNguoiQuanLyTT.Text;

            string cty      = DropCty.SelectedValue.ToString();
            string bophan   = DropBoPhan.SelectedValue.ToString();
            string machucvu = DropDownChucVu.SelectedValue.ToString();
            string congty   = DropCty.SelectedValue.ToString();
            string fileName = FileUpload1.FileName;

            byte[] fileByte  = FileUpload1.FileBytes;
            ChucVu chuc      = ChucVuDAO.TimMaChucVu(machucvu, macongty);
            Binary binaryObj = new Binary(fileByte);

            Busers2 user = new Busers2();
            Regex   reg  = new Regex(match);

            if (reg.IsMatch(this.txtEmail.Text))
            {
                user.EMAIL = txtEmail.Text;
            }
            else
            {
                //if (ngonngu == "lbl_VN")
                //{
                //    lbthongbaoloi.Text = "Email nhập không đúng định dạng, vui lòng nhập lại. Ví dụ: [email protected]";
                //}
                //else if (ngonngu == "lbl_TW")
                //{
                //    lbthongbaoloi.Text = "邮件地址不真确,重新输入,例如: [email protected]";
                //}
                //else if (ngonngu == "lbl_EN")
                //{
                //    lbthongbaoloi.Text = "Enter email not valid, please re-enter. Example:[email protected] ";
                //}
            }
            if (checkCanBo.Checked == true)
            {
                user.isSep = true;
            }
            else
            {
                user.isSep = false;
            }
            if (checkBophan.Checked == true)
            {
                user.BADEPID = bophan;
            }
            else
            {
                user.BADEPID = null;
            }
            user.GSBH      = congty;
            user.USERID    = idnguoidung;
            user.USERNAME  = hoten;
            user.PWD       = matkhau;
            user.Password2 = libraly.Encryption(matkhau2);

            //user.isSep = issep;
            //user.abde = capduyet;
            //user.abstep = buocduyet;
            user.IDCapDuyet     = chuc.IDCapDuyet;
            user.IDChucVu       = machucvu;
            user.IdUserQuanLyTT = nguoiquanlyTT;
            user.signatue       = binaryObj;
            db.Busers2s.InsertOnSubmit(user);
            db.SubmitChanges();
            Response.Redirect("~/presentationLayer/Admin/frmAddUsers.aspx");
        }
Beispiel #22
0
        protected void btnTrinhDuyet_Click(object sender, EventArgs e)
        {
            List <Abcon> ctxdlist = new List <Abcon>();
            pdna         phieudn  = new pdna();

            try
            {
                string maloai  = Session["loaiphieu"].ToString();
                string phieu   = Session["maphieu"].ToString();
                string bophan  = Session["bp"].ToString();
                string noidung = Session["noidung"].ToString();
                string tieude  = Session["tieude"].ToString();
                string congty  = Session["congty"].ToString();
                string user    = Session["user"].ToString();


                //string ngaytao = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy-MM-dd");
                pdna phieun = new pdna();
                {
                    phieun.GSBH       = congty;
                    phieun.pdno       = phieu;
                    phieun.pddepid    = bophan;
                    phieun.mytitle    = tieude;
                    phieun.pdmemovn   = noidung;
                    phieun.CFMDate0   = DateTime.Parse(DateTime.Now.ToShortDateString());
                    phieun.USERID     = user;
                    phieun.CFMID0     = user;
                    phieun.bixoa      = false;
                    phieun.YN         = 0;
                    phieun.USERDATE   = DateTime.Parse(DateTime.Now.ToShortDateString());
                    phieun.ABC        = Convert.ToInt32(DropUutien.SelectedValue.ToString());
                    phieun.LevelDoing = 1;
                }
                db.pdnas.InsertOnSubmit(phieun);
                db.SubmitChanges();
                for (int i = 0; i < TreeView1.Nodes[0].ChildNodes.Count; i++)
                {
                    TreeNode tn = TreeView1.Nodes[0].ChildNodes[i];
                    tn.Value = (i + 1).ToString();

                    foreach (TreeNode node in tn.ChildNodes)
                    {
                        Abcon vb = new Abcon();
                        if (ctxds.TryGetValue(tn.Text, out vb))
                        {
                            // vb.IDCT = MA_CTXetDuyet + (AbconBUS.DemSoLuongMaVanBan_CapDuyet() + 1).ToString();
                            vb.abde    = int.Parse(tn.Value.ToString());
                            vb.pdno    = phieu;
                            vb.cothutu = true;
                            vb.Abstep  = int.Parse(tn.Value.ToString());
                            AbconBUS.ThemChiTiet(vb);
                            ctxdlist.Add(vb);
                        }
                    }
                }
                foreach (string str in lstIdNguoiNhan)
                {
                    Abcon   temp        = AbconBUS.TimKiemVanBanDenTheoIdVanBan_IdNguoiNhan(phieudn.pdno, str, phieudn.CFMID0, false);
                    string  manguoidung = Session["user"].ToString();
                    string  macongty    = Session["congty"].ToString();
                    Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                    if (temp != null)
                    {
                        continue;
                    }
                    Abcon vbd = new Abcon();
                    vbd.from_user = nguoi.USERID;
                    vbd.Auditor   = str;
                    //vbd.pdnoreceived = phieudn.pdno;
                    vbd.from_depart = phieudn.pddepid;
                    vbd.bixoa       = true;
                    AbconBUS.ThemChiTiet(vbd);
                }
            }
            catch (TimeoutException ex)
            {
                foreach (Abcon ct in ctxdlist)
                {
                    AbconBUS.XoaChiTiet(ct.IDCT, false);
                }
                string  manguoidung = Session["user"].ToString();
                string  macongty    = Session["congty"].ToString();
                Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);

                pdnaBUS.XoaVanBan(phieudn, false);
                Until.WriteFileLogServer(nguoi.USERNAME + "\tTạo văn bản\t" + phieudn.pdno + "\tThất bại.");
                LbThongBao.Text = "Lỗi trong quá trình xử lý";
            }
            catch (Exception)
            {
                foreach (Abcon ct in ctxdlist)
                {
                    AbconBUS.XoaChiTiet(ct.IDCT, false);
                }

                string  manguoidung = Session["user"].ToString();
                string  macongty    = Session["congty"].ToString();
                Busers2 nguoi       = UserBUS.TimNhanVienTheoMa(manguoidung, macongty);
                pdnaBUS.XoaVanBan(phieudn, false);
                Until.WriteFileLogServer(nguoi.USERNAME + "\tTạo văn bản\t" + phieudn.pdno + "\tThất bại.");
                LbThongBao.Text = "Lỗi trong quá trình xử lý";
            }
        }