예제 #1
0
        public sFormModels GetRestartModels(dFormData dFormData, string cuurip)
        {
            database       database    = new database();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
            dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
            if (database.checkActiveSql("mssql", "flyformstring", "exec web.deletefilldeta @formId,@inoper;", dbparamlist) != "istrue")
            {
                return(new sFormModels()
                {
                    status = "error"
                });
            }
            DataTable mainRows = new DataTable();

            mainRows = database.checkSelectSql("mssql", "flyformstring", "exec web.searchmaindeta @formId,@inoper;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new sFormModels()
                {
                    status = "nodata"
                });
            }
            int i = 1;

            dbparamlist.Add(new dbparam("@random", mainRows.Rows[0]["randsub"].ToString().TrimEnd()));
            dbparamlist.Add(new dbparam("@number", mainRows.Rows[0]["number"].ToString().TrimEnd()));
            dbparamlist.Add(new dbparam("@finish", mainRows.Rows[0]["finish"].ToString().TrimEnd()));
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "exec web.searchsubdeta @formId,@inoper,@random,@number,@finish;", dbparamlist).Rows)
            {
                dbparamlist.Clear();
                dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                dbparamlist.Add(new dbparam("@iid", int.Parse(dr["iid"].ToString().TrimEnd())));
                dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
                dbparamlist.Add(new dbparam("@random", mainRows.Rows[0]["randopt"].ToString().TrimEnd()));
                List <Dictionary <string, object> > answeritems = new List <Dictionary <string, object> >();
                foreach (DataRow drs in database.checkSelectSql("mssql", "flyformstring", "exec web.searchoptiondeta @formId,@iid,@inoper,@random;", dbparamlist).Rows)
                {
                    answeritems.Add(new Dictionary <string, object>()
                    {
                        { "id", drs["id"].ToString().TrimEnd() }, { "values", drs["value"].ToString().TrimEnd() }, { "showAnswer", drs["answer"].ToString().TrimEnd() == "1" }, { "showRight", drs["right"].ToString().TrimEnd() == "1" }
                    });
                }
                items.Add(new Dictionary <string, object>()
                {
                    { "iid", dr["iid"].ToString().TrimEnd() }, { "title", $"{i}.{dr["tile"].ToString().TrimEnd()}" }, { "showVeri", dr["verified"].ToString().TrimEnd() == "1" }, { "showDrop", false }, { "showFile", false }, { "outValue", dr["outValue"].ToString().TrimEnd() }, { "value", dr["value"].ToString().TrimEnd() }, { "showMenu", false }, { "type_", dr["type"].ToString().TrimEnd() }, { "operation", dr["operation"].ToString().TrimEnd() }, { "area", dr["area"].ToString().TrimEnd() }, { "eror", dr["eror"].ToString().TrimEnd() }, { "showCheck", dr["checked"].ToString().TrimEnd() == "1" }, { "answeritems", answeritems.ToArray() }
                });
                i++;
            }
            return(new sFormModels()
            {
                formId = mainRows.Rows[0]["formId"].ToString().TrimEnd(), tile = mainRows.Rows[0]["tile"].ToString().TrimEnd(), desc = mainRows.Rows[0]["desc"].ToString().TrimEnd(), exam = mainRows.Rows[0]["examed"].ToString().TrimEnd() == "1", restart = mainRows.Rows[0]["restarted"].ToString().TrimEnd() == "1", finish = mainRows.Rows[0]["finish"].ToString().TrimEnd() == "1", score = $"{mainRows.Rows[0]["score"].ToString().TrimEnd()}分", items = items, status = "istrue"
            });
        }
예제 #2
0
        public sOptonModels GetSlimitModels(dFormData dFormData, string cuurip)
        {
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in new database().checkSelectSql("mssql", "epaperstring", "exec web.searchdistinctdert;", new List <dbparam>()).Rows)
            {
                items.Add(new Dictionary <string, object>()
                {
                    { "showPanel", false }, { "dertment", dr["department"].ToString().TrimEnd() }, { "operitems", new List <Dictionary <string, object> >().ToArray() }, { "dertModify", false }
                });
            }
            return(new sOptonModels()
            {
                items = items
            });
        }
예제 #3
0
        public statusModels GetSettModels(dFormData dFormData, string cuurip)
        {
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
            dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
            if (new database().checkActiveSql("mssql", "flyformstring", "exec web.updateallform @formId,@inoper;", dbparamlist) != "istrue")
            {
                return(new statusModels()
                {
                    status = "error"
                });
            }
            return(new statusModels()
            {
                status = "istrue"
            });
        }
예제 #4
0
        public sPormModels GetSItemModels(dFormData dFormData, string cuurip)
        {
            database       database    = new database();
            DataTable      mainRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
            dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
            mainRows = database.checkSelectSql("mssql", "flyformstring", "exec web.searchclimainform @formId,@inoper;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new sPormModels()
                {
                    status = "nodata"
                });
            }
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "exec web.searchclisubform @formId,@inoper;", dbparamlist).Rows)
            {
                dbparamlist.Clear();
                List <Dictionary <string, object> > opticonitems = new List <Dictionary <string, object> >();
                foreach (DataRow drs in new database().checkSelectSql("mssql", "flyformstring", "exec web.searchitemform;", new List <dbparam>()).Rows)
                {
                    opticonitems.Add(new Dictionary <string, object>()
                    {
                        { "opticonPadding", false }, { "icon", drs["icon"].ToString().TrimEnd() }, { "value", drs["value"].ToString().TrimEnd() }
                    });
                }
                List <Dictionary <string, object> > answeritems = new List <Dictionary <string, object> >();
                switch (dr["outValue"].ToString().TrimEnd())
                {
                case "radio":
                case "checkbox":
                case "droplist":
                    dbparamlist.Clear();
                    dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                    dbparamlist.Add(new dbparam("@iid", int.Parse(dr["iid"].ToString().TrimEnd())));
                    dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
                    foreach (DataRow drs in database.checkSelectSql("mssql", "flyformstring", "exec web.searchoptionform @formId,@iid,@inoper;", dbparamlist).Rows)
                    {
                        answeritems.Add(new Dictionary <string, object>()
                        {
                            { "id", int.Parse(drs["id"].ToString().TrimEnd()) }, { "value", drs["value"].ToString().TrimEnd() }, { "showAnswer", drs["answer"].ToString().TrimEnd() == "1" }, { "ansrDelete", false }, { "ansrModify", false }, { "ansrCreate", false }
                        });
                    }
                    break;

                default:
                    answeritems.Add(new Dictionary <string, object>()
                    {
                        { "id", 1 }, { "value", "" }, { "showAnswer", false }, { "ansrDelete", false }, { "ansrModify", false }, { "ansrCreate", true }
                    });
                    break;
                }
                List <Dictionary <string, object> > typeitems = new List <Dictionary <string, object> >(), operationitems = new List <Dictionary <string, object> >();
                switch (dr["verified"].ToString().TrimEnd())
                {
                case "1":
                    dbparamlist.Clear();
                    foreach (DataRow drs in database.checkSelectSql("mssql", "flyformstring", "exec web.searchtypeform;", dbparamlist).Rows)
                    {
                        typeitems.Add(new Dictionary <string, object>()
                        {
                            { "optionPadding", drs["optionPadding"].ToString().TrimEnd() == "1" }, { "value", drs["value"].ToString().TrimEnd() }
                        });
                    }
                    dbparamlist.Add(new dbparam("@value", dr["type"].ToString().TrimEnd()));
                    foreach (DataRow drs in database.checkSelectSql("mssql", "flyformstring", "exec web.searchoperationform @value;", dbparamlist).Rows)
                    {
                        operationitems.Add(new Dictionary <string, object>()
                        {
                            { "optionPadding", drs["optionPadding"].ToString().TrimEnd() == "1" }, { "value", drs["operationValue"].ToString().TrimEnd() }
                        });
                    }
                    break;
                }
                items.Add(new Dictionary <string, object>()
                {
                    { "iid", int.Parse(dr["iid"].ToString().TrimEnd()) }, { "showLine", false }, { "title", dr["tile"].ToString().TrimEnd() }, { "showOut", false }, { "showVeri", dr["verified"].ToString().TrimEnd() == "1" }, { "showDrop", false }, { "showFile", false }, { "outValue", dr["outValue"].ToString().TrimEnd() }, { "type_", dr["type"].ToString().TrimEnd() }, { "showType", false }, { "typeitems", typeitems.ToArray() }, { "operation", dr["operation"].ToString().TrimEnd() }, { "showOperation", false }, { "operationitems", operationitems.ToArray() }, { "area", dr["area"].ToString().TrimEnd() }, { "eror", dr["eror"].ToString().TrimEnd() }, { "showCheck", dr["checked"].ToString().TrimEnd() == "1" }, { "showMore", false }, { "opticonitems", opticonitems.ToArray() }, { "answeritems", answeritems.ToArray() }, { "formDelete", false }, { "formModify", false }, { "formCreate", false }
                });
            }
            List <Dictionary <string, object> > settitems = new List <Dictionary <string, object> >();

            settitems.Add(new Dictionary <string, object>()
            {
                { "stdate", mainRows.Rows[0]["stdate"].ToString().TrimEnd().Replace("/", "-") }, { "sttime", mainRows.Rows[0]["sttime"].ToString().TrimEnd() }, { "endate", mainRows.Rows[0]["endate"].ToString().TrimEnd().Replace("/", "-") }, { "entime", mainRows.Rows[0]["entime"].ToString().TrimEnd() }, { "showExam", mainRows.Rows[0]["examed"].ToString().TrimEnd() == "1" }, { "randOption", mainRows.Rows[0]["randopt"].ToString().TrimEnd() == "1" }, { "randSubtile", mainRows.Rows[0]["randsub"].ToString().TrimEnd() == "1" }, { "showRestart", mainRows.Rows[0]["restarted"].ToString().TrimEnd() == "1" }, { "showLimit", mainRows.Rows[0]["limited"].ToString().TrimEnd() == "1" }, { "dertitems", new List <Dictionary <string, object> >().ToArray() }, { "number", mainRows.Rows[0]["number"].ToString().TrimEnd() }
            });
            return(new sPormModels()
            {
                formId = mainRows.Rows[0]["formId"].ToString().TrimEnd(), tile = mainRows.Rows[0]["tile"].ToString().TrimEnd(), desc = mainRows.Rows[0]["desc"].ToString().TrimEnd(), items = items, settitems = settitems, status = "istrue"
            });
        }
예제 #5
0
        public sOptonModels GetSWriteModels(dFormData dFormData, string cuurip)
        {
            database       database    = new database();
            DataTable      mainRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
            dbparamlist.Add(new dbparam("@inoper", dFormData.newid.TrimEnd()));
            mainRows = database.checkSelectSql("mssql", "flyformstring", "select examed,limited from web.mainform where formId = @formId and inoper = @inoper;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new sOptonModels()
                {
                    items = new List <Dictionary <string, object> >()
                });
            }
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            switch (mainRows.Rows[0]["examed"].ToString().TrimEnd())
            {
            case "0":
                dbparamlist.Clear();
                dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "select inoper from web.millform where formId = @formId order by modate + motime, indate + intime desc;", dbparamlist).Rows)
                {
                    dbparamlist.Clear();
                    DataTable subRows = new DataTable();
                    dbparamlist.Add(new dbparam("@newid", dr["inoper"].ToString().TrimEnd()));
                    subRows = database.checkSelectSql("mssql", "epaperstring", "select userid, username from web.siteber where newid = @newid;", dbparamlist);
                    items.Add(new Dictionary <string, object>()
                    {
                        { "vnewid", dr["inoper"].ToString().TrimEnd() }, { "vuserid", subRows.Rows[0]["userid"].ToString().TrimEnd() }, { "vname", subRows.Rows[0]["username"].ToString().TrimEnd() }, { "writed", "已填寫" }, { "score", "" }
                    });
                }
                return(new sOptonModels()
                {
                    items = items
                });
            }
            switch (mainRows.Rows[0]["limited"].ToString().TrimEnd())
            {
            case "0":
                dbparamlist.Clear();
                dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "select score,inoper from web.millform where formId = @formId order by modate + motime, indate + intime desc;", dbparamlist).Rows)
                {
                    dbparamlist.Clear();
                    DataTable subRows = new DataTable();
                    dbparamlist.Add(new dbparam("@newid", dr["inoper"].ToString().TrimEnd()));
                    subRows = database.checkSelectSql("mssql", "epaperstring", "select userid, username from web.siteber where newid = @newid;", dbparamlist);
                    items.Add(new Dictionary <string, object>()
                    {
                        { "vnewid", dr["inoper"].ToString().TrimEnd() }, { "vuserid", subRows.Rows[0]["userid"].ToString().TrimEnd() }, { "vname", subRows.Rows[0]["username"].ToString().TrimEnd() }, { "writed", "已填寫" }, { "score", $"{dr["score"].ToString().TrimEnd()}分" }
                    });
                }
                return(new sOptonModels()
                {
                    items = items
                });
            }
            foreach (DataRow dr in database.checkSelectSql("mssql", "flyformstring", "select newid from web.operform where formId = @formId and inoper = @inoper;", dbparamlist).Rows)
            {
                dbparamlist.Clear();
                DataTable subRows = new DataTable();
                dbparamlist.Add(new dbparam("@newid", dr["newid"].ToString().TrimEnd()));
                subRows = database.checkSelectSql("mssql", "epaperstring", "select userid, username from web.siteber where newid = @newid;", dbparamlist);
                DataTable otherRows = new DataTable();
                dbparamlist.Add(new dbparam("@formId", dFormData.formId.TrimEnd()));
                otherRows = database.checkSelectSql("mssql", "epaperstring", "select score from web.millform where formId = @formId and inoper = @newid;", dbparamlist);
                items.Add(new Dictionary <string, object>()
                {
                    { "vnewid", dr["newid"].ToString().TrimEnd() }, { "vuserid", subRows.Rows[0]["userid"].ToString().TrimEnd() }, { "vname", subRows.Rows[0]["username"].ToString().TrimEnd() }, { "writed", otherRows.Rows.Count > 0 ? "已填寫" : "未填寫" }, { "score", otherRows.Rows.Count > 0 ? $"{otherRows.Rows[0]["score"].ToString().TrimEnd()}分" : "" }
                });
            }
            return(new sOptonModels()
            {
                items = items
            });
        }