protected override void LoadControls()
    {
        // Outer master Page
        Outer_CP = (ContentPlaceHolder)_page.Form.FindControl("ContentPlaceHolder1");

        // Inner Master Page
        Inner_CP = (ContentPlaceHolder)Outer_CP.FindControl("ContentPlaceHolder1_Menu");
    }
示例#2
0
    private void QueryList()
    {
        Database db = new Database();

        try {
            db.DBConnect();
            str_hidInsertKey = MIPUtil.getFILE_INDEX_SEQ(db.getOcnn()).ToString();
        } catch (Exception ex) {
            throw ex;
        } finally {
            db.getOcnn().Close();
            db.DBDisconnect();
        }


        if (oListView == null)
        {
            ContentPlaceHolder MySecondContent = (ContentPlaceHolder)this.Master.FindControl("ContentPlaceHolder1");
            oListView = MySecondContent.FindControl("oListView") as ASP.dmscontrol_olistview_ascx;
            //StrSearch = MySecondContent.FindControl("StrSearch") as System.Web.UI.HtmlControls.HtmlInputText;
        }

        if (oListView != null)
        {
            //加入欄位Start

            oListView.AddCol("表單類別", "d_note", "CENTER", "auto");
            oListView.AddCol("表單名稱", "cont", "LEFT", "40%");
            oListView.AddCol("最後更新日期", " aldate", "CENTER", "auto");
            oListView.AddCol("排序", " Corder", "CENTER", "auto");
            oListView.AddCol("狀態", "cstatus", "CENTER", "auto");


            //加入欄位End

            //設定Key值欄位
            oListView.DataKeyNames = "HAPPY_ID"; //Key以,隔開

            ////設定是否顯示CheckBox(預設是true);
            ////BosomServiceList.IsUseCheckBox = false;

            StringBuilder sbSQL = new StringBuilder();
            //設定SQL
            sbSQL.Append(@"SELECT
                            a.HAPPY_ID 
                            
                            , (CASE WHEN a.CSTATUS = 1 THEN '停用' WHEN a.CSTATUS = 0 THEN '啟用'  ELSE '未定義'END) cstatus  
                            ,a.Corder   
                            ,b.CNAME as b_note  
                            ,c.CNAME as c_note  
                            ,d.CNAME as d_note  
							,d.CNOTE as Cnote
                            ,(CASE WHEN a.FILE_KIND = 0 THEN '標題:'+a.TITLE+' 檔名:'+  a.F_NAME   WHEN a.FILE_KIND = 1 THEN '標題:'+  a.TITLE  +' 網址:'+ a.URL  ELSE '尋寶圖 URL:' +a.url  END) cont  
                            ,a.LDATE as aldate  
                            ,a.LUSER
                            ,(CASE WHEN a.ISTESTER = 1 THEN '否' WHEN a.ISTESTER = 0 THEN '是'  ELSE '未定義' END) as ISTESTER
                            FROM  MIP_HAPPY a, MIP_CODES b ,MIP_CODES c, MIP_CODES D  
                            where  
                            b.CKEY = a.CKEY1  
                            and c.CKEY = a.CKEY2  
                            and D.CKEY = a.CKEY3 
                            and a.CKEY2 != 'B2020'
                            and d.Cnote = '0' ");

            if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_dlType"])))
            {
                if (MDS.Utility.NUtility.trimBad(Request.QueryString["_dlType"]) != "請選擇")
                {
                    str_dlType = MDS.Utility.NUtility.trimBad(Request.QueryString["_dlType"]);
                    string[] str_dlTypes = str_dlType.Split(new String[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
                    //sbSQL.Append(" and b.CNAME=@b_note ");

                    //oListView.putQueryParameter("b_note", str_dlTypes[0]);
                    //sbSQL.Append(" and c.CNAME=@c_note ");
                    //oListView.putQueryParameter("Cnote", str_dlTypes[1]);
                    if (str_dlTypes.Length == 2)
                    {
                        sbSQL.Append(" and  d.CNAME =@dCNAME ");
                        oListView.putQueryParameter("dCNAME", str_dlTypes[0]);

                        _dlType.SelectedValue = (MDS.Utility.NUtility.trimBad(str_dlTypes[1]));
                    }
                }
            }
            if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_txtSrch"])))
            {
                str_txtSrch = MDS.Utility.NUtility.trimBad(Request.QueryString["_txtSrch"]);
                sbSQL.Append(" and ( a.TITLE like '%'+@txtSrch+'%'  or  a.F_NAME like '%'+@txtSrch+'%') ");
                oListView.putQueryParameter("txtSrch", str_txtSrch);
            }

            if (!string.IsNullOrEmpty(Request.QueryString["_chkIC"]) && string.IsNullOrEmpty(Request.QueryString["_chkRM"]))
            {
                sbSQL.Append("and exists(select * from MIP_HAPPY_TARGET e where e.HAPPY_ID=a.HAPPY_ID and e.DTYPE=0 and e.DEPT_ID='IC') ");
                oListView.putQueryParameter("DEPT_ID", Request.QueryString["_chkIC"]);
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["_chkRM"]) && string.IsNullOrEmpty(Request.QueryString["_chkIC"]))
            {
                sbSQL.Append("and exists(select * from MIP_HAPPY_TARGET e where e.HAPPY_ID=a.HAPPY_ID and e.DTYPE=0 and e.DEPT_ID='RM') ");
                oListView.putQueryParameter("DEPT_ID", Request.QueryString["_chkRM"]);
            }

            sbSQL.Append(" order by a.CKEY1, a.CKEY2, a.CKEY3, a.CORDER, a.LDATE ");



            //sbSQL.Append(" ORDER BY a.LDATA DESC,a.VDATE DESC ");

            //取得SQL;
            oListView.SelectString = sbSQL.ToString();
            oListView.prepareStatement();
            string showSql = sbSQL.ToString();
            Debug.Write(showSql);

            //設定每筆資料按下去的Javascript function
            oListView.OnClickExecFunc = "DoEdt()";

            //設定每頁筆數
            oListView.PageSize = 26;

            //接來自Request的排序欄位、排序方向、目前頁數
            ListViewSortKey       = Request.Params["ListViewSortKey"];
            ListViewSortDirection = Request.Params["ListViewSortDirection"];
            PageNo = Request.Params["PageNo"];

            //設定排序欄位及方向
            if (!string.IsNullOrEmpty(ListViewSortKey) && !string.IsNullOrEmpty(ListViewSortDirection))
            {
                oListView.ListViewSortKey       = ListViewSortKey;
                oListView.ListViewSortDirection = (SortDirection)Enum.Parse(typeof(SortDirection), ListViewSortDirection);
            }

            //設定目前頁數
            if (!string.IsNullOrEmpty(PageNo))
            {
                oListView.PageNo = int.Parse(PageNo);
            }
        }
    }
示例#3
0
    public void CreateReport()
    {
        LocalReport report = new LocalReport();
        string      mimeType, encoding, fileExtension;

        string[]  streams;
        Warning[] warnings;

        int year             = Int32.Parse(Session["year"].ToString());
        ReportDataSource rds = new ReportDataSource();

        rds.Name = "SampleAnalize";
        string    username  = User.Identity.Name;
        UserInfos userinfos = UserInfos.getUserInfos(username);
        int       fermaid   = GetFermaId(userinfos.UserCod);

        if (fermaid != 0)
        {
            List <SampleAnalize> samples = SampleAnalize.GetSampleAnalize(fermaid, "", year);
            if (samples.Count > 0)
            {
                string[] parIds          = { "g", "p", "c", "l", "s", "h", "u", "n", "z" };
                string[] chartLabelsName = { "Grasime (g/100g)", "Proteine (g/100g)", "Cazeina (g/100g)", "Lactoza (g/100g)", "SUN (g/100g)", "pH", "Uree (mg/dl)", "NCSx1000", "Cantitate lapte (l)" };
                string[] chartTitles     = { "Grasime", "Proteine", "Cazeina",
                                             "Lactoza",     "SUN",      "Ph",
                                             "Uree",        "NCS",      "Cantitate lapte" };
                string[] um = { "g/100g", "g/100g", "g/100g", "g/100g", "g/100g", "pH", "mg/dl", "NCSx1000", "l" };

                ContentPlaceHolder holder = (ContentPlaceHolder)Master.FindControl("MainContent");
                for (int i = 0; i < parIds.Length; i++)
                {
                    string   endChar = parIds[i].ToUpper();
                    CheckBox chk     = (CheckBox)holder.FindControl("chk" + endChar);
                    if (chk.Checked)
                    {
                        //set current param
                        foreach (SampleAnalize sample in samples)
                        {
                            switch (i)
                            {
                            case 0:
                                sample.Val = sample.Grasime; break;

                            case 1:
                                sample.Val = sample.Proteine; break;

                            case 2:
                                sample.Val = sample.Caseina; break;

                            case 3:
                                sample.Val = sample.Lactoza; break;

                            case 4:
                                sample.Val = sample.Solide; break;

                            case 5:
                                sample.Val = sample.Ph; break;

                            case 6:
                                sample.Val = sample.Urea; break;

                            case 7:
                                sample.Val = sample.Ncs; break;

                            case 8:
                                sample.Val = sample.Cantitate; break;

                            default: break;
                            }
                            sample.Val = Math.Round(sample.Val, 2);
                        }
                        // create samplescontrol from samples

                        // set reports datasource
                        rds.Value = samples;
                        report.DataSources.Clear();
                        report.DataSources.Add(rds);

                        //
                        ReportDataSource rdsc = new ReportDataSource();
                        rdsc.Name = "SampleAnalizeControl";
                        List <SampleAnalizeControl> samplescontrol = SampleAnalize.getSampleAnalizeControl(samples, year);
                        rdsc.Value = samplescontrol;
                        report.DataSources.Add(rdsc);
                        // detaliu
                        ReportDataSource rdscrot = new ReportDataSource();
                        rdscrot.Name = "SampleAnalizeCrotalia";
                        List <SampleAnalizeCrotalia> samplescrot = SampleAnalize.getSampleAnalizeCrotalia(fermaid, i, year);
                        rdscrot.Value = samplescrot;
                        report.DataSources.Add(rdscrot);

                        report.ReportPath = "ControlsSummary.rdlc";
                        string datatestare = "Data: " + DateTime.Now.ToString("dd/MM/yyyy");
                        // set reports parameters
                        string          title            = userinfos.NumeFerma + " - " + "Cod exploatatie " + userinfos.UserCod;
                        ReportParameter pCod             = new ReportParameter("CodExpl", title);
                        ReportParameter pData            = new ReportParameter("DataExec", datatestare);
                        ReportParameter pChartTitle      = new ReportParameter("ChartTitle", chartTitles[i]);
                        ReportParameter pChartLabelsName = new ReportParameter("ChartLabelsName", chartLabelsName[i]);
                        ReportParameter pUm = new ReportParameter("Um", um[i]);

                        ReportParameter[] p = { pCod, pData, pChartTitle, pChartLabelsName, pUm };
                        report.SetParameters(p);
                        report.Refresh();
                        // write xls
                        string httppath = ConfigurationManager.AppSettings["httppath"];
                        //"/Downloads/";
                        string filepath = ConfigurationManager.AppSettings["filepath"];
                        //"D:\\portal\\Downloads\\";
                        string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
                        string fileid           = chartTitles[i];
                        if (i == 8)
                        {
                            fileid = fileid.Substring(0, 4);
                        }
                        string raport_excel = "Grafic" + fileid + "_" + userinfos.UserCod + "_" + (DateTime.Now).ToString("ddMMyyyy") + ".xls";
                        string excel_file   = filepath + raport_excel;
                        string excel_link   = path_raport_http + raport_excel;
                        byte[] xls_content  = report.Render("EXCEL", deviceInfoXls, out mimeType, out encoding, out fileExtension, out streams, out warnings);
                        File.WriteAllBytes(excel_file, xls_content);
                        //rename sheets
                        using (StreamReader input = new StreamReader(excel_file))
                        {
                            HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(input.BaseStream));
                            if (workbook != null)
                            {
                                workbook.SetSheetName(0, "Grafic");
                                workbook.SetSheetName(1, "Detaliu date");
                                WriteExcel(excel_file, workbook);
                            }
                        }

                        //

                        //  HyperLink hyper = (HyperLink)holder.FindControl("xlslink" + parIds[i]);
                        // hyper.Visible = true;
                        //hyper.NavigateUrl = excel_link;
                        //hyper.Text = raport_excel;
                        ErrorMessage.Text = "";
                    } //checked
                }     //for
            }         //samplecount >0
        }             //fermaid >0
        else
        {
            // ErrorMessage.Text = "Nu exista date pentru codul "+ userinfos.UserCod;
        }
    }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //btnAcYr.Attributes.Add("onclick", "return callvaliadteAcademic();");
            user = (clsUser)Session["User"];

            if (user != null && user.Exist)
            {
                sUser = user.User_ID;
            }
            else
            {
                Response.Redirect(Classes.clsGetSettings.SitePath.ToString() + "Logout.aspx");
            }

            if (user.UserTypeCode == "2")
            {
                instIDs         = user.UserReferenceID;
                hidInstID.Value = instIDs.ToString();
                //divAcademicYr.Style.Add("display", "block");
                divWaitMsg.Style.Add("display", "none");
            }

            if (IsPostBack)
            {
                flag = 1;
            }


            if (!IsPostBack)
            {
                if (PreviousPage != null)
                {
                    ContentPlaceHolder Cntp = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");

                    if (((HtmlInputHidden)Cntp.FindControl("hidInstID")).Value != null || ((HtmlInputHidden)Cntp.FindControl("hidInstID")).Value != "")
                    {
                        hidInstID.Value = ((HtmlInputHidden)Cntp.FindControl("hidInstID")).Value;
                    }
                }

                instIDs = "";
                //DataTable dt = clsCollegeAdmissionReports.GetAcademicYear();
                //Common.fillDropDown(ddlAcademicYr, dt, "", "Year", "pk_AcademicYear_ID", "--- Select ---");
                //ddlAcademicYr.SelectedIndex = 0;
                Session.Remove("dtdata");

                hidUniID.Value = Classes.clsGetSettings.UniversityID.ToString();
            }

            ContentPlaceHolder Cntph = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");


            hid_AcademicYear.Value     = ((DropDownList)YCMOU.FindControl("ddlAcadYear")).SelectedItem.Text;
            hid_fk_AcademicYr_ID.Value = ((DropDownList)YCMOU.FindControl("ddlAcadYear")).SelectedValue;

            YCMOU.IsInstituteDisplay         = false;
            YCMOU.IsFacultyDisplay           = false;
            YCMOU.IsCourseDisply             = false;
            YCMOU.IsCoursePartDisply         = false;
            YCMOU.IsCourseTermDisply         = false;
            YCMOU.IsBranchDisply             = false;
            YCMOU.IsReportUserAndDateDisplay = false;
            YCMOU.isMISRpt.Value             = "Yes";
            YCMOU.OnProceedClick            += btnAcYr_Click;
        }
示例#5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            clsCache.NoCache();
            // Put user code to initialize the page here
            if (!IsPostBack)
            {
                HtmlInputHidden[] hid = new HtmlInputHidden[22];
                hid[0]  = hidInstID;
                hid[1]  = hidUniID;
                hid[2]  = hidElgFormNo;
                hid[3]  = hidpkFacID;
                hid[4]  = hidpkYear;
                hid[5]  = hidpkStudentID;
                hid[6]  = hidpkCrID;
                hid[7]  = hidpkMoLrnID;
                hid[8]  = hidpkPtrnID;
                hid[9]  = hidpkBrnID;
                hid[10] = hidpkCrPrDetailsID;
                hid[11] = hidPRN;
                hid[12] = hidIsBlank;
                hid[13] = hidAcademicYr;

                hid[14] = hid_fk_AcademicYr_ID;
                hid[15] = hidAcademicYrText;
                hid[16] = hidFacName;
                hid[17] = hidCrName;
                hid[18] = hidMOLName;
                hid[19] = hidPattern;
                hid[20] = hidBrName;
                hid[21] = hidSearchType;

                Common.setHiddenVariables(ref hid);
            }

            if (hidInstID.Value != "" && hidInstID.Value != null)
            {
                // hidInstID.Value = Request.QueryString["InstituteID"].ToString().Trim();
                lblPageHead.Text  = "Resolve Pending Eligibility";
                lblSubHeader.Text = "  for " + InstRep.InstituteName(hidUniID.Value, hidInstID.Value);
                //lblInstitute.Text = "  for " + clsInstitute.InstituteName(hidUniID.Value, hidInstID.Value);
            }
            rbEligible.Attributes.Add("onclick", "fnDisplayDiv();");
            rbProvisional.Attributes.Add("onclick", "fnDisplayDiv();");
            rbDefaulter.Attributes.Add("onclick", "fnDisplayDiv();");
            rbPending.Attributes.Add("onclick", "fnDisplayDiv();");
            btnSubmit.Attributes.Add("onclick", "return fnConfirm();");
            userob = (clsUser)Session["User"];
            userid = userob.User_ID.ToString();

            if (Request.QueryString["Search"] == "Simple")
            {
                btnGoTo.Text = "Go To Search";
            }
            else            // Search == "Adv"
            {
                btnGoTo.Text = "Go To Student List";
            }

            if (!IsPostBack)
            {
                //ELGV2_ResolvePending_reg_Students__1 ob = (ELGV2_ResolvePending_reg_Students__1)System.Web.HttpContext.Current.Handler;
                //WebCtrl.StudentAdvanceSearchForConfigure_reg_Students tempHidden = (WebCtrl.StudentAdvanceSearchForConfigure_reg_Students)ob.FindControl("StudentAdvanceSeachForConfigure1");

                ContentPlaceHolder Cntph = (ContentPlaceHolder)Page.PreviousPage.Master.FindControl("ContentPlaceHolder1");
                WebCtrl.StudentAdvanceSearchForConfigure_reg_Students tempHidden = (WebCtrl.StudentAdvanceSearchForConfigure_reg_Students)Cntph.FindControl("StudentAdvanceSeachForConfigure1");

                if (Request.QueryString["Search"] == "Adv")
                {
                    hidElgFormNo.Value         = ((HtmlInputHidden)tempHidden.FindControl("hidElgFormNo")).Value;
                    hidpkYear.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidpkYear")).Value;
                    hidpkStudentID.Value       = ((HtmlInputHidden)tempHidden.FindControl("hidpkStudentID")).Value;
                    hidpkFacID.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidFacID")).Value;
                    hidpkCrID.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidCrID")).Value;
                    hidpkMoLrnID.Value         = ((HtmlInputHidden)tempHidden.FindControl("hidMoLrnID")).Value;
                    hidpkPtrnID.Value          = ((HtmlInputHidden)tempHidden.FindControl("hidPtrnID")).Value;
                    hidpkBrnID.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidBrnID")).Value;
                    hidpkCrPrDetailsID.Value   = ((HtmlInputHidden)tempHidden.FindControl("hidCrPrDetailsID")).Value;
                    hid_fk_AcademicYr_ID.Value = ((HtmlInputHidden)tempHidden.FindControl("hid_fk_AcademicYr_ID")).Value;
                    hidAcademicYrText.Value    = ((HtmlInputHidden)tempHidden.FindControl("hidAcademicYrText")).Value;
                    hidInstID.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidInstID")).Value;
                    hidFacName.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidFacName")).Value;
                    hidCrName.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidCrName")).Value;
                    hidMOLName.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidMOLName")).Value;
                    hidPattern.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidPattern")).Value;
                    hidBrName.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidBrName")).Value;
                    hidInstID.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidInstID")).Value;
                    hidAcYrName.Value          = ((HtmlInputHidden)tempHidden.FindControl("hidAcYrName")).Value;
                    hidSearchType.Value        = ((HtmlInputHidden)tempHidden.FindControl("hidSearchType")).Value;
                    hidBranchName.Value        = ((HtmlInputHidden)tempHidden.FindControl("hidBranchName")).Value;
                }
                if (Request.QueryString["Search"] == "Simple")
                {
                    hidElgFormNo.Value         = ((HtmlInputHidden)tempHidden.FindControl("hidElgFormNo")).Value;
                    hidPRN.Value               = ((HtmlInputHidden)tempHidden.FindControl("hidPRN")).Value;
                    hidpkYear.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidpkYear")).Value;
                    hidpkStudentID.Value       = ((HtmlInputHidden)tempHidden.FindControl("hidpkStudentID")).Value;
                    hidpkFacID.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidFacID")).Value;
                    hidpkCrID.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidCrID")).Value;
                    hidpkMoLrnID.Value         = ((HtmlInputHidden)tempHidden.FindControl("hidMoLrnID")).Value;
                    hidpkPtrnID.Value          = ((HtmlInputHidden)tempHidden.FindControl("hidPtrnID")).Value;
                    hidpkBrnID.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidBrnID")).Value;
                    hidpkCrPrDetailsID.Value   = ((HtmlInputHidden)tempHidden.FindControl("hidCrPrDetailsID")).Value;
                    hidIsBlank.Value           = ((HtmlInputHidden)tempHidden.FindControl("hidIsBlank")).Value;
                    hidInstID.Value            = ((HtmlInputHidden)tempHidden.FindControl("hidInstID")).Value;
                    hid_fk_AcademicYr_ID.Value = ((HtmlInputHidden)tempHidden.FindControl("hid_fk_AcademicYr_ID")).Value;
                }
                hidElgFlag.Value = "NotAssigned";
                FetchStudentDetails();
                divPRN.Style.Add("Display", "none");
                GoToDataBase            = 1;
                Session["GoToDataBase"] = GoToDataBase;
            }
            else if (IsPostBack)
            {
                GoToDataBase = Convert.ToInt32(Session["GoToDataBase"].ToString());
            }
        }