Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00020"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }

                CategorysMN aCategorysMN = new CategorysMN();
                ddlDepartment.Items.Clear();
                ddlDepartment.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, "CT-00002");
                ddlDepartment.DataValueField = "CatCode";
                ddlDepartment.DataTextField  = "CatName";
                ddlDepartment.DataBind();
                ddlDepartment.Items.Insert(0, new ListItem("---ALL---", "ALL"));
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00008"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }

                CategorysMN aCategorysMN = new CategorysMN();
                string      CatTypeCode  = string.Empty;
                CatTypeCode             = "CT-00006";
                ddlGroup.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlGroup.DataValueField = "CatCode";
                ddlGroup.DataTextField  = "CatName";
                ddlGroup.DataBind();
                ddlGroup.SelectedValue = "CT-00026";
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00030"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }
                hidUserName.Value = LoginSession.UserName();

                CategorysMN aCategorysMN = new CategorysMN();
                string      CatTypeCode  = string.Empty;
                CatTypeCode = "CT-00010";
                cboStates.Items.Clear();
                cboStates.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                cboStates.DataValueField = "CatCode";
                cboStates.DataTextField  = "CatName";
                cboStates.DataBind();
                cboStates.Items.Insert(0, new ListItem("---All---", "ALL"));

                txtFromApplicationDate.Text = DateTime.Now.AddMonths(-1).ToString("yyyy/MM/dd");
                txtToApplicationDate.Text   = DateTime.Now.ToString("yyyy/MM/dd");
            }
        }
Ejemplo n.º 4
0
 public static bool SendMail(string sendto, string bccto, string copyto, string title, string body)
 {
     try
     {
         CategorysMN aCategorysMN = new CategorysMN();
         DataTable   aData        = aCategorysMN.GetCategorysByCode("EMAIL");
         if (aData.Rows.Count > 0)
         {
             MailFlow.SMTPMail aMailflow = new MailFlow.SMTPMail();
             return(aMailflow.MailSend("vnesop6688!@!@", Convert.ToString(aData.Rows[0]["CatName"]).Trim(), sendto, copyto, bccto, title, body));
             //return false;
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00023"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }
                hidUserName.Value = LoginSession.UserName();

                #region
                UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN();

                CategorysMN aCategorysMN = new CategorysMN();
                ListItem    aListItem    = new ListItem();
                string      CatTypeCode  = string.Empty;
                CatTypeCode = "CT-00003"; //Application Site
                ddlApplicationSite.Items.Clear();
                ddlApplicationSite.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlApplicationSite.DataValueField = "CatCode";
                ddlApplicationSite.DataTextField  = "CatName";
                ddlApplicationSite.DataBind();

                //CatTypeCode = "CT-00004"; //Doc Type
                //ddlDocType.Items.Clear();
                //ddlDocType.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                //ddlDocType.DataValueField = "CatCode";
                //ddlDocType.DataTextField = "CatName";
                //ddlDocType.DataBind();



                CatTypeCode = "CT-00002";
                ddlPreservingDepartment.Items.Clear();
                ddlPreservingDepartment.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlPreservingDepartment.DataValueField = "CatCode";
                ddlPreservingDepartment.DataTextField  = "CatName";
                ddlPreservingDepartment.DataBind();
                ddlPreservingDepartment.Items.Insert(0, new ListItem("---ALL---", "ALL"));

                #endregion

                #region
                hidStatus.Value = Convert.ToString(Request.QueryString["Type"]);
                string EditDocument    = Convert.ToString(Request.QueryString["EditDocument"]);
                string PublishDocument = Convert.ToString(Request.QueryString["PublishDocument"]);



                RegisterPublishSecurityMN aRegisterPublishDocumentMN = new RegisterPublishSecurityMN();
                RegisterEditSecurityMN    aRegisterEditDocumentMN    = new RegisterEditSecurityMN();
                if (!String.IsNullOrEmpty(PublishDocument))
                {
                    #region

                    ddlDepartment.Items.Clear();
                    ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName());
                    ddlDepartment.DataValueField = "Department";
                    ddlDepartment.DataTextField  = "NameDepartment";
                    ddlDepartment.DataBind();


                    DataTable aData = aRegisterPublishDocumentMN.ListRegisterPublishDocument(PublishDocument, string.Empty, string.Empty,
                                                                                             string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                    txtEffectiveDate.Text   = string.Empty;
                    txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    if (aData.Rows.Count > 0)
                    {
                        txtApplicationName.Text  = LoginSession.FullName();
                        hidPublishDocument.Value = PublishDocument;
                        hidCodeDocument.Value    = Convert.ToString(aData.Rows[0]["CodeDocument"]);
                        txtApplicationNO.Text    = Convert.ToString(aData.Rows[0]["PublishDocument"]);
                        ddlApplicationSite.Text  = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                        txtDocNO.Text            = Convert.ToString(aData.Rows[0]["DocumentNo"]);

                        DataTable aTemp = aRegisterEditDocumentMN.GetNextAlphabet(Convert.ToString(aData.Rows[0]["Rev"]).Trim());
                        txtREV.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["Word"]).Trim() : "Hết phiên bản";

                        txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);
                        //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]);
                        //txtRevisionApplication.Text = Convert.ToString(aData.Rows[0]["RevisionApplication"]);
                        //txtCheckingNotice.Text = Convert.ToString(aData.Rows[0]["CheckingNotice"]);

                        txtDocumentObsolete.Text  = Convert.ToString(aData.Rows[0]["DeletedDocumentOld"]);
                        txtDocumentReference.Text = Convert.ToString(aData.Rows[0]["ReferenceDocument"]);
                        //txtWordKey.Text = Convert.ToString(aData.Rows[0]["IndexWord"]);

                        hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                        //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]);
                        //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]);
                        //hidFileName.Value = Convert.ToString(aData.Rows[0]["ContentFile"]);
                        //hidNeedRelease.Value = Convert.ToString(aData.Rows[0]["NeedReleaseFile"]);

                        aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"]));
                        if (aListItem != null)
                        {
                            ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]);
                        }
                    }

                    #endregion
                }
                else if (!String.IsNullOrEmpty(EditDocument))
                {
                    #region

                    DataTable aData = aRegisterEditDocumentMN.ListRegisterEditDocument(EditDocument, string.Empty, string.Empty,
                                                                                       string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                    if (aData.Rows.Count > 0)
                    {
                        ddlDepartment.Items.Clear();
                        ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(Convert.ToString(aData.Rows[0]["CreatedBy"]));
                        ddlDepartment.DataValueField = "Department";
                        ddlDepartment.DataTextField  = "NameDepartment";
                        ddlDepartment.DataBind();

                        txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]);
                        hidID.Value             = Convert.ToString(aData.Rows[0]["ID"]);
                        hidEditDocument.Value   = EditDocument;

                        hidPublishDocument.Value = Convert.ToString(aData.Rows[0]["PublishDocument"]);
                        hidStates.Value          = Convert.ToString(aData.Rows[0]["States"]);
                        txtApplicationNO.Text    = Convert.ToString(aData.Rows[0]["EditDocument"]);
                        hidCodeDocument.Value    = Convert.ToString(aData.Rows[0]["CodeDocument"]);

                        ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                        txtEffectiveDate.Text   = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty;
                        txtDocNO.Text           = Convert.ToString(aData.Rows[0]["DocumentNo"]);

                        txtREV.Text     = Convert.ToString(aData.Rows[0]["Rev"]);
                        txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);
                        //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]);
                        //txtRevisionApplication.Text = Convert.ToString(aData.Rows[0]["RevisionApplication"]);
                        //txtCheckingNotice.Text = Convert.ToString(aData.Rows[0]["CheckingNotice"]);

                        txtDocumentObsolete.Text  = Convert.ToString(aData.Rows[0]["DeletedDocumentOld"]);
                        txtDocumentReference.Text = Convert.ToString(aData.Rows[0]["ReferenceDocument"]);
                        //txtWordKey.Text = Convert.ToString(aData.Rows[0]["IndexWord"]);

                        txtApplicationDate.Text = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss");
                        hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                        //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]);
                        //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]);
                        hidFileName.Value    = Convert.ToString(aData.Rows[0]["ContentFile"]);
                        hidNeedRelease.Value = Convert.ToString(aData.Rows[0]["NeedReleaseFile"]);

                        aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"]));
                        if (aListItem != null)
                        {
                            ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]);
                        }
                    }

                    #endregion
                }
                else
                {
                    Response.Redirect("Default.aspx");
                }
                #endregion
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00026") && !LoginSession.IsView("MN-00027"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }
                hidUserName.Value = LoginSession.UserName();

                #region
                CategorysMN aCategorysMN = new CategorysMN();
                ListItem    aListItem    = new ListItem();
                string      CatTypeCode  = string.Empty;
                CatTypeCode = "CT-00003"; //Application Site
                ddlApplicationSite.Items.Clear();
                ddlApplicationSite.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlApplicationSite.DataValueField = "CatCode";
                ddlApplicationSite.DataTextField  = "CatName";
                ddlApplicationSite.DataBind();

                CatTypeCode = "CT-00004"; //Doc Type
                ddlDocType.Items.Clear();
                ddlDocType.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlDocType.DataValueField = "CatCode";
                ddlDocType.DataTextField  = "CatName";
                ddlDocType.DataBind();

                CatTypeCode = "CT-00002"; //Department
                ddlCurrentDepartment.Items.Clear();
                ddlCurrentDepartment.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlCurrentDepartment.DataValueField = "CatCode";
                ddlCurrentDepartment.DataTextField  = "CatName";
                ddlCurrentDepartment.DataBind();
                ddlCurrentDepartment.Items.Insert(0, new ListItem("ALL", "ALL"));

                #endregion

                #region
                string DocumentNo = Convert.ToString(Request.QueryString["DocumentNo"]);
                string CodeCheck  = Convert.ToString(Request.QueryString["CodeCheck"]);

                if (!String.IsNullOrEmpty(DocumentNo))
                {
                    #region
                    CheckingNoticeMN   aCheckingNoticeMN   = new CheckingNoticeMN();
                    UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN();
                    txtApplicationName.Text = LoginSession.FullName();

                    DataTable aTemp = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName());
                    if (aTemp.Rows.Count > 0)
                    {
                        txtDepartment.Text = Convert.ToString(aTemp.Rows[0]["NameDepartment"]);
                    }
                    else
                    {
                        txtDepartment.Text = string.Empty;
                    }
                    txtApplicationNO.Text   = string.Empty;
                    txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    DataTable aData = aCheckingNoticeMN.ListRegisterCheckingNotice(string.Empty, string.Empty, DocumentNo,
                                                                                   Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                    if (aData.Rows.Count > 0)
                    {
                        hidPublishDocument.Value = Convert.ToString(aData.Rows[0]["PublishDocument"]);

                        txtDocNO.Text   = Convert.ToString(aData.Rows[0]["DocumentNo"]);
                        txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);
                        txtREV.Text     = Convert.ToString(aData.Rows[0]["Rev"]);
                        ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                        ddlDocType.SelectedValue         = Convert.ToString(aData.Rows[0]["DocumentType"]);
                        hidApplicableSite.Value          = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                        hidApplicableBU.Value            = Convert.ToString(aData.Rows[0]["ApplicableBU"]);

                        txtOriginalResponsible.Text = Convert.ToString(aData.Rows[0]["Original"]);
                        txtRemark.Text = Convert.ToString(aData.Rows[0]["Remark"]);
                    }

                    #endregion
                }
                else
                {
                    if (!String.IsNullOrEmpty(CodeCheck))
                    {
                        #region
                        CheckingNoticeMN aCheckingNoticeMN = new CheckingNoticeMN();
                        DataTable        aData             = aCheckingNoticeMN.ListCheckingNotice(CodeCheck, string.Empty, string.Empty, string.Empty, string.Empty,
                                                                                                  Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                        if (aData.Rows.Count > 0)
                        {
                            txtDepartment.Text       = Convert.ToString(aData.Rows[0]["Department_Name"]);
                            txtApplicationNO.Text    = Convert.ToString(aData.Rows[0]["CodeCheck"]);
                            txtApplicationName.Text  = Convert.ToString(aData.Rows[0]["HoTen"]);
                            txtApplicationDate.Text  = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss");
                            hidPublishDocument.Value = Convert.ToString(aData.Rows[0]["PublishDocument"]);

                            txtDocNO.Text   = Convert.ToString(aData.Rows[0]["DocumentNo"]);
                            txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);
                            txtREV.Text     = Convert.ToString(aData.Rows[0]["Rev"]);
                            ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                            ddlDocType.SelectedValue         = Convert.ToString(aData.Rows[0]["DocumentType"]);

                            txtOriginalResponsible.Text        = Convert.ToString(aData.Rows[0]["Original"]);
                            ddlCurrentDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]);
                            hidCurrentDirector.Value           = Convert.ToString(aData.Rows[0]["Director"]);
                            txtCurrentDirector.Text            = Convert.ToString(aData.Rows[0]["Director_Name"]);
                            txtRemark.Text = Convert.ToString(aData.Rows[0]["Remark"]);

                            hidCodeCheck.Value      = Convert.ToString(aData.Rows[0]["CodeCheck"]);
                            hidID.Value             = Convert.ToString(aData.Rows[0]["ID"]);
                            hidStates.Value         = Convert.ToString(aData.Rows[0]["States"]);
                            hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                            hidApplicableBU.Value   = Convert.ToString(aData.Rows[0]["ApplicableBU"]);



                            if (hidStates.Value.Equals("F05"))
                            {
                                UsersMN aUsersMN = new UsersMN();
                                ddlPerson.Items.Clear();
                                ddlPerson.DataSource     = aUsersMN.ListDetailUserByDepartment(Convert.ToString(aData.Rows[0]["Department"]), string.Empty);
                                ddlPerson.DataValueField = "TenDangNhap";
                                ddlPerson.DataTextField  = "HoTen";
                                ddlPerson.DataBind();
                            }
                        }
                        #endregion
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00028"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }
                hidUserName.Value = LoginSession.UserName();

                #region
                UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN();
                RenewalsDocumentMN aRenewalsDocumentMN = new RenewalsDocumentMN();
                CategorysMN        aCategorysMN        = new CategorysMN();
                ListItem           aListItem           = new ListItem();
                string             CatTypeCode         = string.Empty;
                CatTypeCode = "CT-00003"; //Application Site
                ddlApplicationSite.Items.Clear();
                ddlApplicationSite.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlApplicationSite.DataValueField = "CatCode";
                ddlApplicationSite.DataTextField  = "CatName";
                ddlApplicationSite.DataBind();
                #endregion

                #region
                string Code        = Convert.ToString(Request.QueryString["Code"]);
                string DCC         = Convert.ToString(Request.QueryString["DCC"]);
                string RenewalCode = Convert.ToString(Request.QueryString["RenewalCode"]);

                if (!String.IsNullOrEmpty(Code) && !String.IsNullOrEmpty(DCC))
                {
                    #region
                    ddlDepartment.Items.Clear();
                    ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName());
                    ddlDepartment.DataValueField = "Department";
                    ddlDepartment.DataTextField  = "NameDepartment";
                    ddlDepartment.DataBind();

                    hidType.Value           = Convert.ToString(Request.QueryString["Type"]);
                    txtApplicationName.Text = LoginSession.FullName();
                    txtApplicationNO.Text   = string.Empty;
                    txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    DataTable aData = aRenewalsDocumentMN.ListRegisterRenewalDocument(Code, DCC, string.Empty);
                    if (aData.Rows.Count > 0)
                    {
                        aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"]));
                        if (aListItem != null)
                        {
                            ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                        }
                        aListItem = ddlType.Items.FindByValue(Convert.ToString(aData.Rows[0]["Type"]));
                        if (aListItem != null)
                        {
                            ddlType.SelectedValue = Convert.ToString(aData.Rows[0]["Type"]);
                        }
                        txtApplicationCode.Text = Convert.ToString(aData.Rows[0]["Code"]);
                        txtDocNO.Text           = Convert.ToString(aData.Rows[0]["DCC"]);
                        txtRevised.Text         = Convert.ToString(aData.Rows[0]["Revised"]);
                        txtRevisor.Text         = Convert.ToString(aData.Rows[0]["Revisor"]);
                        txtCloseDate.Text       = Convert.ToString(aData.Rows[0]["CloseDate"]);
                    }

                    #endregion
                }
                else
                {
                    if (!String.IsNullOrEmpty(RenewalCode))
                    {
                        #region
                        ddlDepartment.Items.Clear();
                        ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName());
                        ddlDepartment.DataValueField = "Department";
                        ddlDepartment.DataTextField  = "NameDepartment";
                        ddlDepartment.DataBind();

                        DataTable aData = aRenewalsDocumentMN.ListRenewalsDocument(RenewalCode, string.Empty, string.Empty, string.Empty, string.Empty,
                                                                                   Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                        if (aData.Rows.Count > 0)
                        {
                            hidID.Value          = Convert.ToString(aData.Rows[0]["ID"]);
                            hidStates.Value      = Convert.ToString(aData.Rows[0]["States"]);
                            hidRenewalCode.Value = Convert.ToString(aData.Rows[0]["RenewalCode"]);

                            txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]);
                            txtApplicationNO.Text   = Convert.ToString(aData.Rows[0]["RenewalCode"]);
                            txtApplicationDate.Text = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss");

                            aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"]));
                            if (aListItem != null)
                            {
                                ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                            }
                            aListItem = ddlType.Items.FindByValue(Convert.ToString(aData.Rows[0]["TypeRenewal"]));
                            if (aListItem != null)
                            {
                                ddlType.SelectedValue = Convert.ToString(aData.Rows[0]["TypeRenewal"]);
                            }
                            aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"]));
                            if (aListItem != null)
                            {
                                ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]);
                            }

                            txtApplicationCode.Text = Convert.ToString(aData.Rows[0]["DocumentNo"]);
                            txtDocNO.Text           = Convert.ToString(aData.Rows[0]["DCC_NO"]);
                            txtRevised.Text         = Convert.ToString(aData.Rows[0]["BeforRevised"]);
                            txtRevisor.Text         = Convert.ToString(aData.Rows[0]["BeforRevisor"]);
                            txtCloseDate.Text       = Convert.ToString(aData.Rows[0]["BeforCloseDate"]);

                            txtEffectiveDate.Text  = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty;
                            txtReason.Text         = Convert.ToString(aData.Rows[0]["Reason"]);
                            txtAfterRevisor.Text   = Convert.ToString(aData.Rows[0]["Revisor"]);
                            txtAfterCloseDate.Text = Convert.ToDateTime(aData.Rows[0]["CloseDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["CloseDate"]).ToString("yyyy/MM/dd") : string.Empty;


                            if (hidStates.Value.Equals("H05") || hidStates.Value.Equals("H10"))
                            {
                                UsersMN aUsersMN = new UsersMN();
                                ddlDirecter.Items.Clear();
                                ddlDirecter.DataSource     = aUsersMN.ListDetailUserByDepartment(string.Empty, "C-00004");
                                ddlDirecter.DataValueField = "TenDangNhap";
                                ddlDirecter.DataTextField  = "HoTen";
                                ddlDirecter.DataBind();
                                ddlDirecter.Items.Insert(0, new ListItem("ALL", "ALL"));
                                if (hidStates.Value.Equals("H10"))
                                {
                                    ddlDirecter.SelectedIndex = 1;
                                }
                            }
                        }
                        #endregion
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    #region
                    if (LoginSession.IsLogin())
                    {
                        if (!LoginSession.IsAdmin())
                        {
                            if (!LoginSession.IsView("MN-00011"))
                            {
                                Response.Redirect("NoPermitsion.aspx");
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                    }
                    hidUserName.Value = LoginSession.UserName();
                    #endregion

                    #region
                    string CodeDocument   = Convert.ToString(Request.QueryString["CodeDocument"]);
                    string DocNo          = Convert.ToString(Request.QueryString["DocNo"]);
                    string CancelDocument = Convert.ToString(Request.QueryString["CancelDocument"]);

                    CategorysMN aCategorysMN = new CategorysMN();
                    ListItem    aListItem    = new ListItem();
                    string      CatTypeCode  = string.Empty;
                    CatTypeCode = "CT-00003"; //Application Site
                    ddlApplicationSite.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                    ddlApplicationSite.DataValueField = "CatCode";
                    ddlApplicationSite.DataTextField  = "CatName";
                    ddlApplicationSite.DataBind();

                    //CatTypeCode = "CT-00007"; //Type of closing application
                    //ddlCloseDocument.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                    //ddlCloseDocument.DataValueField = "CatCode";
                    //ddlCloseDocument.DataTextField = "CatName";
                    //ddlCloseDocument.DataBind();


                    UserInDepartmentMN aUserInDepartmentMN = new UserInDepartmentMN();
                    #endregion

                    #region
                    RegisterCancelSecurityMN aRegisterCancelDocumentMN = new RegisterCancelSecurityMN();
                    if (!String.IsNullOrEmpty(CodeDocument) && !String.IsNullOrEmpty(DocNo))
                    {
                        #region

                        ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(LoginSession.UserName());
                        ddlDepartment.DataValueField = "Department";
                        ddlDepartment.DataTextField  = "NameDepartment";
                        ddlDepartment.DataBind();

                        DataTable aData = aRegisterCancelDocumentMN.ListDocmentRefByCodeDocumentAndCodeDCC(CodeDocument, DocNo);
                        txtApplicationName.Text = LoginSession.FullName();
                        txtApplicationNO.Text   = string.Empty;
                        txtApplicationDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                        if (aData.Rows.Count > 0)
                        {
                            aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"]));
                            if (aListItem != null)
                            {
                                ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                            }
                            txtApplicationNo_DCC.Text = Convert.ToString(aData.Rows[0]["CodeDocument"]);
                            txtDocNo_DCC.Text         = Convert.ToString(aData.Rows[0]["DocNo"]);
                            txtNameFile.Text          = Convert.ToString(aData.Rows[0]["DocName"]);
                            //txtAssignedRevisor.Text = Convert.ToString(aData.Rows[0]["AssignedRevisor"]);
                            txtEstimatedCloseData.Text = Convert.ToString(aData.Rows[0]["EstimatedCloseDate"]);
                        }


                        #endregion
                    }
                    else if (!String.IsNullOrEmpty(CancelDocument))
                    {
                        #region

                        DataTable aData = aRegisterCancelDocumentMN.ListRegisterCancelDocument(CancelDocument, string.Empty, string.Empty, string.Empty,
                                                                                               string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                        if (aData.Rows.Count > 0)
                        {
                            ddlDepartment.DataSource     = aUserInDepartmentMN.ListDepartmentByUserName(Convert.ToString(aData.Rows[0]["CreatedBy"]));
                            ddlDepartment.DataValueField = "Department";
                            ddlDepartment.DataTextField  = "NameDepartment";
                            ddlDepartment.DataBind();


                            hidID.Value             = Convert.ToString(aData.Rows[0]["ID"]);
                            hidCancelDocument.Value = Convert.ToString(aData.Rows[0]["CancelDocument"]);
                            hidStates.Value         = Convert.ToString(aData.Rows[0]["States"]);

                            txtApplicationName.Text = Convert.ToString(aData.Rows[0]["HoTen"]);
                            txtApplicationNO.Text   = Convert.ToString(aData.Rows[0]["CancelDocument"]);
                            txtApplicationDate.Text = Convert.ToDateTime(aData.Rows[0]["ApplicationDate"]).ToString("yyyy/MM/dd HH:mm:ss");

                            aListItem = ddlApplicationSite.Items.FindByValue(Convert.ToString(aData.Rows[0]["ApplicationSite"]));
                            if (aListItem != null)
                            {
                                ddlApplicationSite.SelectedValue = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                            }

                            txtEffectiveDate.Text = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty;

                            //aListItem = ddlCloseDocument.Items.FindByValue(Convert.ToString(aData.Rows[0]["CloseDocument"]));
                            //if (aListItem != null)
                            //{
                            //    ddlCloseDocument.SelectedValue = Convert.ToString(aData.Rows[0]["CloseDocument"]);
                            //}

                            txtApplicationNo_DCC.Text = Convert.ToString(aData.Rows[0]["ApplicationNo_Code"]);
                            txtDocNo_DCC.Text         = Convert.ToString(aData.Rows[0]["DocNo"]);
                            txtNameFile.Text          = Convert.ToString(aData.Rows[0]["DocName"]);
                            //txtAssignedRevisor.Text = Convert.ToString(aData.Rows[0]["AssignedRevisor"]);
                            txtEstimatedCloseData.Text = Convert.ToString(aData.Rows[0]["EstimatedCloseDate"]);

                            txtReasonApplication.Text = Convert.ToString(aData.Rows[0]["ReasonOfApplication"]);
                            aListItem = ddlDepartment.Items.FindByValue(Convert.ToString(aData.Rows[0]["Department"]));
                            if (aListItem != null)
                            {
                                ddlDepartment.SelectedValue = Convert.ToString(aData.Rows[0]["Department"]);
                            }
                        }

                        #endregion
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LoginSession.IsLogin())
                {
                    if (!LoginSession.IsAdmin())
                    {
                        if (!LoginSession.IsView("MN-00016"))
                        {
                            Response.Redirect("NoPermitsion.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Account/Login.aspx?Url=" + Request.Url.PathAndQuery);
                }
                hidUserName.Value = LoginSession.UserName();

                #region
                UsersMN     aUsersMN     = new UsersMN();
                CategorysMN aCategorysMN = new CategorysMN();
                ListItem    aListItem    = new ListItem();
                string      CatTypeCode  = string.Empty;
                CatTypeCode = "CT-00003"; //Application Site
                ddlApplicationSite.DataSource     = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                ddlApplicationSite.DataValueField = "CatCode";
                ddlApplicationSite.DataTextField  = "CatName";
                ddlApplicationSite.DataBind();

                //CatTypeCode = "CT-00004"; //Doc Type
                //ddlDocType.DataSource = aCategorysMN.ListCategorys(string.Empty, string.Empty, CatTypeCode);
                //ddlDocType.DataValueField = "CatCode";
                //ddlDocType.DataTextField = "CatName";
                //ddlDocType.DataBind();

                #endregion

                #region
                string PublishDocument   = Convert.ToString(Request.QueryString["PublishDocument"]);
                string ObsoletedDocument = Convert.ToString(Request.QueryString["ObsoletedDocument"]);

                if (!String.IsNullOrEmpty(PublishDocument))
                {
                    #region
                    RegisterPublishDocumentMN aRegisterPublishDocumentMN = new RegisterPublishDocumentMN();
                    txtApplicationName.Text  = LoginSession.FullName();
                    txtApplicationNO.Text    = string.Empty;
                    txtApplicationDate.Text  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    hidPublishDocument.Value = PublishDocument;

                    DataTable aData = aRegisterPublishDocumentMN.ListRegisterPublishDocument(PublishDocument, string.Empty, "C26", string.Empty,
                                                                                             string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                    if (aData.Rows.Count > 0)
                    {
                        ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                        //hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                        txtDocNO.Text   = Convert.ToString(aData.Rows[0]["DocumentNo"]);
                        txtREV.Text     = Convert.ToString(aData.Rows[0]["Rev"]);
                        txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);

                        txtReleaseDate.Text = Convert.ToString(aData.Rows[0]["EffectiveDate_Text"]);
                        //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]);
                        //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]);
                        //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]);

                        DataTable aTemp = new DataTable();
                        aTemp = aCategorysMN.ListCategorys(Convert.ToString(aData.Rows[0]["Department"]), string.Empty, string.Empty);
                        txtApplicationDep.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty;
                        txtDepartment.Text     = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty;
                        aTemp           = aUsersMN.GetManagerCurrent();
                        txtManager.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["HoTen"]) : string.Empty;
                    }

                    #endregion
                }
                else
                {
                    if (!String.IsNullOrEmpty(ObsoletedDocument))
                    {
                        #region

                        ApplicationObsoletedDocumentMN aApplicationObsoletedDocumentMN = new ApplicationObsoletedDocumentMN();
                        DataTable aData = aApplicationObsoletedDocumentMN.ListApplicationObsoletedDocument(ObsoletedDocument, string.Empty, string.Empty,
                                                                                                           string.Empty, string.Empty, string.Empty, string.Empty, Convert.ToDateTime("1900-01-01"), Convert.ToDateTime("1900-01-01"));
                        if (aData.Rows.Count > 0)
                        {
                            txtApplicationName.Text    = Convert.ToString(aData.Rows[0]["HoTen"]);
                            hidID.Value                = Convert.ToString(aData.Rows[0]["ID"]);
                            hidObsoletedDocument.Value = ObsoletedDocument;
                            hidStates.Value            = Convert.ToString(aData.Rows[0]["States"]);
                            txtApplicationNO.Text      = Convert.ToString(aData.Rows[0]["ObsoletedDocument"]);
                            hidPublishDocument.Value   = Convert.ToString(aData.Rows[0]["PublishDocument"]);
                            txtEffectiveDate.Text      = Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).Year > 1900 ? Convert.ToDateTime(aData.Rows[0]["EffectiveDate"]).ToString("yyyy/MM/dd") : string.Empty;
                            txtApplicationDate.Text    = Convert.ToString(aData.Rows[0]["ApplicationDate_Text"]);

                            ddlApplicationSite.Text = Convert.ToString(aData.Rows[0]["ApplicationSite"]);
                            //hidApplicableSite.Value = Convert.ToString(aData.Rows[0]["ApplicableSite"]);
                            txtDocNO.Text   = Convert.ToString(aData.Rows[0]["DocumentNo"]);
                            txtREV.Text     = Convert.ToString(aData.Rows[0]["Rev"]);
                            txtDocName.Text = Convert.ToString(aData.Rows[0]["DocumentName"]);

                            txtReleaseDate.Text = Convert.ToString(aData.Rows[0]["EffectiveDate_Text"]);
                            //ddlDocType.Text = Convert.ToString(aData.Rows[0]["DocumentType"]);
                            //hidApplicableBU.Value = Convert.ToString(aData.Rows[0]["ApplicableBU"]);
                            //hidDepartmentCheck.Value = Convert.ToString(aData.Rows[0]["DepartmentCheck"]);

                            DataTable aTemp = new DataTable();
                            aTemp = aCategorysMN.ListCategorys(Convert.ToString(aData.Rows[0]["Department"]), string.Empty, string.Empty);
                            txtApplicationDep.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty;
                            txtDepartment.Text     = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["CatName"]) : string.Empty;
                            aTemp           = aUsersMN.GetManagerCurrent();
                            txtManager.Text = aTemp.Rows.Count > 0 ? Convert.ToString(aTemp.Rows[0]["HoTen"]) : string.Empty;

                            txtReasonObsoleted.Text = Convert.ToString(aData.Rows[0]["ReasonObsoleted"]);
                        }

                        #endregion
                    }
                }
                #endregion
            }
        }