Пример #1
0
 public static bool SuaQuyTrinh(QPDNFlow pquytrinh)
 {
     try
     {
         QPDNFlow quytrinh = new QPDNFlow();
         quytrinh                      = db.QPDNFlows.Where(p => p.IDQuyTrinh == pquytrinh.IDQuyTrinh && p.GSBH == pquytrinh.GSBH && p.abtype == pquytrinh.abtype && p.ABstep == pquytrinh.ABstep && p.BADEPID == pquytrinh.BADEPID && p.ABPS == pquytrinh.ABPS).FirstOrDefault();
         quytrinh.IDQuyTrinh           = pquytrinh.IDQuyTrinh;
         quytrinh.GSBH                 = pquytrinh.GSBH;
         quytrinh.abtype               = pquytrinh.abtype;
         quytrinh.abtypenameTW         = pquytrinh.abtypenameTW;
         quytrinh.BADEPID              = pquytrinh.BADEPID;
         quytrinh.tendonviTW           = pquytrinh.tendonviTW;
         quytrinh.NguoiDuyet           = pquytrinh.NguoiDuyet;
         quytrinh.USERNAME             = pquytrinh.USERNAME;
         quytrinh.ABstep               = pquytrinh.ABstep;
         quytrinh.DonViThongQua        = pquytrinh.DonViThongQua;
         quytrinh.tendonvithongqua     = pquytrinh.tendonvithongqua;
         quytrinh.IDLoaiDonVi          = pquytrinh.IDLoaiDonVi;
         quytrinh.DepartmentTypeNameTW = pquytrinh.DepartmentTypeNameTW;
         quytrinh.ABstep               = pquytrinh.ABstep;
         quytrinh.IDChucVu             = pquytrinh.IDChucVu;
         quytrinh.TenChucVuTiengHoa    = pquytrinh.TenChucVuTiengHoa;
         quytrinh.ABPS                 = pquytrinh.ABPS;
         // quytrinh.VangMat = pquytrinh.VangMat;
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
 public static bool ThemQuyTrinh(QPDNFlow pquytrinh)
 {
     try
     {
         db.QPDNFlows.InsertOnSubmit(pquytrinh);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 public static bool XoaQuyTrinh1(QPDNFlow quytrinhxd)
 {
     try
     {
         QPDNFlow quytrinh = db.QPDNFlows.Where(p => p.IDQuyTrinh == quytrinhxd.IDQuyTrinh && p.GSBH == quytrinhxd.GSBH && p.abtype == quytrinhxd.abtype && p.ABstep == quytrinhxd.ABstep && p.ABPS == quytrinhxd.ABPS && p.BADEPID == quytrinhxd.BADEPID).FirstOrDefault();
         db.QPDNFlows.DeleteOnSubmit(quytrinh);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
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");
        }
Пример #5
0
        public static bool CapNhatQuyTrinh(QPDNFlow quytrinh)
        {
            try
            {
                QPDNFlow ss = db.QPDNFlows.Where(p => p.GSBH == quytrinh.GSBH && p.abtype == quytrinh.abtype && p.ABstep == quytrinh.ABstep && p.ABPS == quytrinh.ABPS && p.BADEPID == quytrinh.BADEPID).FirstOrDefault();

                ss.ABstep = quytrinh.ABstep;
                db.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
 public static bool XoaQuyTrinh(string GSBH, string abtype, int ABstep, string BADEPID, int ABPS)
 {
     try
     {
         QPDNFlow quytrinh = new QPDNFlow();
         quytrinh = db.QPDNFlows.Where(p => p.GSBH == GSBH && p.abtype == abtype && p.ABstep == ABstep && p.BADEPID == BADEPID && p.ABPS == ABPS).FirstOrDefault();
         db.QPDNFlows.DeleteOnSubmit(quytrinh);
         db.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string macongty = DropCty.SelectedValue.ToString();

            string madonvi = DropDownLDonVi.SelectedValue.ToString();

            string   manguoiduyet = txtNguoiDuyet.Text;
            string   chucvu       = DropDownChucVu.SelectedValue.ToString();
            ChucVu   chuc         = ChucVuDAO.TimMaChucVu(chucvu, macongty);
            QPDNFlow quytrinh     = new QPDNFlow();

            //quytrinh.IDQuyTrinh = maquytrinh + (QPDNFlowDAO.DemQPDNFlow() + 1).ToString();
            quytrinh.BADEPID = madonvi;

            quytrinh.GSBH = macongty;

            quytrinh.IDChucVu    = DropDownChucVu.SelectedValue.ToString();
            quytrinh.IDCapDuyet  = chuc.IDCapDuyet;
            quytrinh.IDLoaiDonVi = int.Parse(DropDownLoaiDV.SelectedValue.ToString());
            if (cbLoaiPhieu.Checked == true)
            {
                quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
            }
            else
            {
                quytrinh.abtype = "MD";
            }
            if (CheckThongQuaDonVi.Checked == true)
            {
                quytrinh.DonViThongQua = DropDownDonViThongQua.SelectedValue.ToString();
            }
            else
            {
                quytrinh.DonViThongQua = null;
            }
            if (txtNguoiDuyet.Text.Trim() == null)
            {
                quytrinh.NguoiDuyet = "MD";
            }
            else
            {
                quytrinh.NguoiDuyet = manguoiduyet;
            }
            QPDNFlowDAO.ThemQuyTrinh(quytrinh);
            HienThiDanhSach();
        }
Пример #8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (lbThongBao.Text != "")
            {
                lbThongBao.Text = "";
            }
            string manguoiduyet1 = Session["manguoiduyet"].ToString();
            int    id            = int.Parse(Session["id"].ToString());

            if (lbThongBao.Text.Trim() != "")
            {
                lbThongBao.Text = "";
            }
            string macongty = DropCty.SelectedValue.ToString();

            string madonvi = DropDownLDonVi.SelectedValue.ToString();

            string   manguoiduyet = txtNguoiDuyet.Text;
            int      AbStep       = int.Parse(DropDownABStep.SelectedValue);
            int      ABPS         = int.Parse(DropDownABPS.SelectedValue);
            QPDNFlow quytrinh     = new QPDNFlow();

            if (manguoiduyet == "ZZZZZZ")
            {
                quytrinh.ABPS   = 1;
                quytrinh.ABstep = 1;
                if (DropDownLoaiPhieu.SelectedValue.ToString().Trim() == "")
                {
                    quytrinh.abtype = "PDN1";
                    abill timloai = abillBUS.SearchAbillByID(quytrinh.abtype);
                    quytrinh.abtypenameTW = timloai.abnameTW;
                }
                else
                {
                    quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
                    abill timloai = abillBUS.SearchAbillByID(DropDownLoaiPhieu.SelectedValue.ToString());
                    quytrinh.abtypenameTW = timloai.abnameTW;
                }
                quytrinh.BADEPID = "All";
                quytrinh.DepartmentTypeNameTW = "间接单位";
                quytrinh.GSBH              = macongty;
                quytrinh.IDCapDuyet        = 7;
                quytrinh.IDChucVu          = "CQDV";
                quytrinh.IDLoaiDonVi       = 2;
                quytrinh.NguoiDuyet        = "ZZZZZZ";
                quytrinh.USERNAME          = "";
                quytrinh.TenChucVuTiengHoa = "单位主管";
                quytrinh.tendonviTW        = "All";

                dal.CapNhatQuyTrinh(macongty, quytrinh.abtype, madonvi, AbStep, ABPS, quytrinh.NguoiDuyet, quytrinh.USERNAME, quytrinh.abtypenameTW, quytrinh.tendonviTW, int.Parse(quytrinh.IDLoaiDonVi.ToString()), quytrinh.DepartmentTypeNameTW, int.Parse(quytrinh.IDCapDuyet.ToString()));
            }
            else
            {
                if (madonvi == "All")
                {
                    quytrinh.BADEPID              = "All";
                    quytrinh.tendonviTW           = "All";
                    quytrinh.GSBH                 = macongty;
                    quytrinh.IDLoaiDonVi          = 2;
                    quytrinh.DepartmentTypeNameTW = "间接单位";
                }
                else
                {
                    BDepartment      donvi     = BDepartmentDAO.TimMaDonVi(madonvi, macongty);
                    AbDepartmentType loaidonvi = LoaiDonViDAO.TimMaLoaiDonVi(int.Parse(donvi.DepartmentTypeID.ToString()), macongty);

                    quytrinh.BADEPID              = madonvi;
                    quytrinh.tendonviTW           = donvi.DepName;
                    quytrinh.GSBH                 = macongty;
                    quytrinh.IDLoaiDonVi          = loaidonvi.DepartmentTypeID;
                    quytrinh.DepartmentTypeNameTW = loaidonvi.DepartmentTypeNameTW;
                }
                if (DropDownLoaiPhieu.SelectedValue.ToString().Trim() == "")
                {
                    quytrinh.abtype = "PDN1";
                    abill timloai = abillBUS.SearchAbillByID(quytrinh.abtype);
                    quytrinh.abtypenameTW = timloai.abnameTW;
                }
                else
                {
                    quytrinh.abtype = DropDownLoaiPhieu.SelectedValue.ToString();
                    abill timloai = abillBUS.SearchAbillByID(DropDownLoaiPhieu.SelectedValue.ToString());
                    quytrinh.abtypenameTW = timloai.abnameTW;
                }
                quytrinh.DonViThongQua = null;
                quytrinh.NguoiDuyet    = txtNguoiDuyet.Text;
                Busers2 nguoi      = UserDAO.TimNhanVienTheoMa(manguoiduyet, macongty);
                int     idcapduyet = int.Parse(nguoi.IDCapDuyet.ToString());
                quytrinh.USERNAME = nguoi.USERNAME;
                ChucVu chuc = ChucVuDAO.TimMaChucVu(nguoi.IDChucVu, macongty);
                quytrinh.IDChucVu         = chuc.IDChucVu;
                quytrinh.tendonvithongqua = chuc.TenChucVuTiengHoa;
                quytrinh.IDCapDuyet       = nguoi.IDCapDuyet;
                quytrinh.ABstep           = AbStep;
                quytrinh.ABPS             = ABPS;

                QPDNFlow tim = QPDNFlowDAO.TimNguoiTrongQuyTrinh(nguoi.USERID, quytrinh.abtype, quytrinh.BADEPID, macongty);
                if (tim != null)
                {
                    dal.CapNhatQuyABPS(macongty, quytrinh.abtype, madonvi, id, AbStep, ABPS);
                }
                else
                {
                    QPDNFlow timbuoccansua = QPDNFlowDAO.TimBuocKyCanSua(macongty, quytrinh.abtype, quytrinh.BADEPID, AbStep, ABPS);
                    if (timbuoccansua != null)
                    {
                        dal.CapNhatQuyTrinh(macongty, quytrinh.abtype, madonvi, AbStep, ABPS, quytrinh.NguoiDuyet, quytrinh.USERNAME, quytrinh.abtypenameTW, quytrinh.tendonviTW, int.Parse(quytrinh.IDLoaiDonVi.ToString()), quytrinh.DepartmentTypeNameTW, int.Parse(quytrinh.IDCapDuyet.ToString()));
                    }
                    List <Abcon> dsPhieuChuaDuyet = AbconDAO.dsPhieuChuaDuyetTheoBuocDuyetCapDuyet(macongty, madonvi, quytrinh.abtype, AbStep, ABPS);
                    foreach (Abcon phieu in dsPhieuChuaDuyet)
                    {
                        Abcon timnguoi = AbconDAO.TimNguoiDuyetTrongPhieu(madonvi, macongty, quytrinh.abtype, phieu.pdno, nguoi.USERID);
                        if (timnguoi == null)
                        {
                            dalabcon.CapNhatAbcon(macongty, quytrinh.abtype, phieu.pdno, nguoi.USERID, phieu.IDCT, AbStep, idcapduyet, ABPS);
                        }
                    }
                }
            }
            Response.Redirect("FQPDNFlow.aspx");
        }