protected override void OnPrimaryKeyChangedAsync()
 {
     string studentID = this.PrimaryKey;
     //1.取得修課紀錄
     QueryHelper q = new QueryHelper();
     string sql = @"select ref_course_id
                             from $ischool.emba.scattend_ext att inner join course c on c.id = att.ref_course_id
                             where att.ref_student_id={0} and c.school_year={1} and c.semester={2}";
     //string schoolyear = K12.Data.School.DefaultSchoolYear;
     //string semester = K12.Data.School.DefaultSemester;
     DataTable dt = q.Select(string.Format(sql, studentID, this.SchoolYear, this.Semester));
     this.attRecords = new List<string>();
     foreach (DataRow dr in dt.Rows)
     {
         this.attRecords.Add(dr[0].ToString());
     }
     this.attRecords = this.attRecords.Distinct().ToList();
     //2. 取得加退選紀錄
     AccessHelper ah = new AccessHelper();
     this.udtCourses = ah.Select<UDT.AddDropCourse>("ref_student_id='" + this.PrimaryKey + "' and confirm_date is null ");
     this.dicAddDropList = new Dictionary<string, UDT.AddDropCourse>();
     foreach (UDT.AddDropCourse addDrop in this.udtCourses)
     {
         if (!this.dicAddDropList.ContainsKey(addDrop.CourseID.ToString()))
             this.dicAddDropList.Add(addDrop.CourseID.ToString(), addDrop);
     }
 }
        public Absence_EmailNotification()
        {
            InitializeComponent();

            Access = new AccessHelper();
            Query = new QueryHelper();
        }
        public frmEvaluationConfiguration(bool QueryMode = true)
        {
            InitializeComponent();

            this.dgvData.CurrentCellDirtyStateChanged += new EventHandler(dgvData_CurrentCellDirtyStateChanged);
            this.dgvData.CellEnter += new DataGridViewCellEventHandler(dgvData_CellEnter);
            this.dgvData.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(dgvData_EditingControlShowing);
            this.dgvData.DataError += new DataGridViewDataErrorEventHandler(dgvData_DataError);
            this.dgvData.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_ColumnHeaderMouseClick);
            this.dgvData.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_RowHeaderMouseClick);
            this.dgvData.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dgvData_MouseClick);

            this.Load += new EventHandler(frmTeachingEvaluation_Load);
            dgvData.SortCompare += new DataGridViewSortCompareEventHandler(
                this.DataGridView_SortCompare);

            this.dicTeachersCases = new Dictionary<string, List<string>>();
            this.dicReplys = new Dictionary<string, UDT.Reply>();
            this.dicCourses = new Dictionary<string, CourseRecord>();
            this.dicCourseInstructors = new Dictionary<string, KeyValuePair<string, string>>();
            this.dicCases = new Dictionary<string, List<string>>();
            this.dicSurveys = new Dictionary<string, UDT.Survey>();
            this.dicAssignedSurveys = new Dictionary<string, UDT.AssignedSurvey>();

            this.QueryMode = QueryMode;

            Access = new AccessHelper();
            Query = new QueryHelper();
        }
        /// <summary>
        /// 取得科目中英文對照表
        /// </summary>
        /// <returns></returns>
        public static Dictionary<string,string> SelectAll()
        {
            //"科目中英文對照表"
            //<Content>
            //   <Subject Chinese="國文" English="Chinese"/>
            //   <Subject Chinese="英文" English="English"/>
            //</Content>

            QueryHelper helper = new QueryHelper();

            Dictionary<string, string> result = new Dictionary<string, string>();

            DataTable table = helper.Select("select * from list where name='科目中英文對照表'");

            if (table.Rows.Count == 1)
            {
                string Content = table.Rows[0].Field<string>("content");

                StringReader reader = new StringReader(Content);

                XElement Element = XElement.Load(reader);

                foreach (XElement elmSubject in Element.Elements("Subject"))
                {
                    string Chinese = elmSubject.AttributeText("Chinese");
                    string English = elmSubject.AttributeText("English");

                    if (!result.ContainsKey(Chinese))
                        result.Add(Chinese, English);
                }
            }

            return result;
       }
Ejemplo n.º 5
0
        public Approach_DetailContent()
        {
            InitializeComponent();

            Access = new AccessHelper();
            Query = new QueryHelper();
            dicSurveyFields = new Dictionary<decimal, IEnumerable<string>>();

            this.Group = "畢業學生進路";
            _RunningKey = "";

            this.Load += new EventHandler(Form_Load);
            this.form_loaded = false;
            _Errors = new ErrorProvider();
            _Listener = new ChangeListener();
            _Listener.Add(new DataGridViewSource(this.dgvData));
            _Listener.Add(new TextBoxSource(this.txtMemo));
            _Listener.Add(new NumericUpDownSource(this.txtSurveyYear));
            _Listener.StatusChanged += new EventHandler<ChangeEventArgs>(Listener_StatusChanged);

            this.dgvData.CellEnter += new DataGridViewCellEventHandler(dgvData_CellEnter);
            this.dgvData.CurrentCellDirtyStateChanged += new EventHandler(dgvData_CurrentCellDirtyStateChanged);
            this.dgvData.DataError += new DataGridViewDataErrorEventHandler(dgvData_DataError);
            this.dgvData.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_ColumnHeaderMouseClick);
            this.dgvData.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_RowHeaderMouseClick);
            this.dgvData.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dgvData_MouseClick);

            _BGWLoadData = new BackgroundWorker();
            _BGWLoadData.DoWork += new DoWorkEventHandler(_BGWLoadData_DoWork);
            _BGWLoadData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWLoadData_RunWorkerCompleted);

            _BGWSaveData = new BackgroundWorker();
            _BGWSaveData.DoWork += new DoWorkEventHandler(_BGWSaveData_DoWork);
            _BGWSaveData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWSaveData_RunWorkerCompleted);
        }
Ejemplo n.º 6
0
 private string GetReturnUrl()
 {
     QueryHelper helper = new QueryHelper(this);
     helper.Push("df", this.txtDateFrom.Text);
     helper.Push("dt", this.txtDateTo.Text);
     return helper.OutputReturnUrl();
 }
Ejemplo n.º 7
0
    private void btnSave_Click(object sender, EventArgs e)
    {
        string classname = txtName.Text.Trim();

            if (classname == String.Empty)
                return;

            QueryHelper queryHelper = new QueryHelper();
            string strQuery = String.Format(@"select class_name from class where class_name='{0}'", classname);

            DataTable dataTable = queryHelper.Select(strQuery);

            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                K12.Data.ClassRecord addRecord = new K12.Data.ClassRecord();

                addRecord.Name = classname;

                string addRecord_ID = K12.Data.Class.Insert(addRecord);
                //Class.Instance.SyncDataBackground(ClassID);   同步處理
                //  log 待處理
                //PermRecLogProcess prlp = new PermRecLogProcess();
                //prlp.SaveLog("學籍.班級", "新增班級", "新增班級,名稱:" + txtName.Text);
                if (chkInputData.Checked)
                    K12.Presentation.NLDPanels.Class.PopupDetailPane(addRecord_ID);
                //Class.Instance.SyncDataBackground(ClassID);   同步處理
            }
            else
            {
                MessageBox.Show("班級名稱重複");
                return;
            }
            this.Close();
    }
Ejemplo n.º 8
0
 private string GetReturnUrl()
 {
     QueryHelper helper = new QueryHelper(this);
     helper.Push("pd", this.drpPeriod.SelectedValue);
     helper.Push("df", this.txtDateFrom.Text.Trim());
     helper.Push("dt", this.txtDateTo.Text.Trim());
     return helper.OutputReturnUrl();
 }
        public frmCoursePlanUrl()
        {
            queryHelper = new QueryHelper();
            Access = new AccessHelper();

            InitializeComponent();
            this.Load += new EventHandler(frmCoursePlanUrl_Load);
        }
 public Course_Student_List(List<string> CourseIDs)
 {
     this.CourseIDs = CourseIDs;
     this.Query = new QueryHelper();
     this.BGW = new BackgroundWorker();
     this.BGW.DoWork += new DoWorkEventHandler(BGW_DoWork);
     this.BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);
 }
 public Student_UpdateRecord_Export_Excel(IEnumerable<string> StudentIDs)
 {
     this.StudentIDs = StudentIDs;
     this.Query = new QueryHelper();
     this.BGW = new BackgroundWorker();
     this.BGW.DoWork += new DoWorkEventHandler(BGW_DoWork);
     this.BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);
 }
        public Approach_Export()
        {
            InitializeComponent();

            this.Load += new System.EventHandler(this.Form_Load);
            this.chkSelectAll.CheckedChanged += new System.EventHandler(this.chkSelectAll_CheckedChanged);
            this.selectedFields = new List<string>();
            this.Query = new QueryHelper();
        }
        public frmCSAttendToSnapshot()
        {
            InitializeComponent();

            Query = new QueryHelper();
            Access = new AccessHelper();

            this.Load += new EventHandler(frmCSAttendToSnapshot_Load);
        }
        public TemplateManagement()
        {
            InitializeComponent();

            Access = new AccessHelper();
            Query = new QueryHelper();

            this.Load += new EventHandler(TemplateManagement_Load);
        }
Ejemplo n.º 15
0
 /// <summary>
 /// 檢查一般學生學號是否重複
 /// </summary>
 /// <param name="number"></param>
 /// <returns></returns>
 public static bool CheckStudentNumberSame1(string number)
 {
     bool retVal = false;
     QueryHelper qh = new QueryHelper();
     string strSQL = "select id from student where status=1 and student_number='"+number+"'";
     DataTable dt= qh.Select(strSQL);
     if (dt.Rows.Count > 0)
         retVal = true;
     return retVal;
 }
        public Course_Case_Usage()
        {
            InitializeComponent();
            this.Group = "使用個案";

            this.Load += new System.EventHandler(this.Course_Case_Usage_Load);

            Access = new AccessHelper();
            Query = new QueryHelper();
        }
 string GetReturnUrl()
 {
     QueryHelper helper = new QueryHelper(this);
     helper.GetValue(this.txtLogis); //传参_方法1
     helper.GetValue(this.txtMemberName); //传参_方法2
     helper.GetValue(this.txtMemberNumber);
     helper.Push("ps", this.magicPagerMain.PageSize);
     helper.Push("pi", this.magicPagerMain.CurrentPageIndex);
     return helper.OutputReturnUrl();
 }
        public CSAttend()
        {
            InitializeComponent();

            this.Access = new AccessHelper();
            this.Query = new QueryHelper();

            InitializeData();

            this.Load += new EventHandler(CSAttendResult_Load);
        }
        public Approach_Report()
        {
            InitializeComponent();

            this.Load += new EventHandler(Form_Load);

            Access = new AccessHelper();
            Query = new QueryHelper();

            this.InitSchoolYear();
        }
        public ImportReportDocumentTemplate(UDT.ReportTemplate template = null, string templateName = "")
        {
            InitializeComponent();

            Access = new AccessHelper();
            Query = new QueryHelper();
            this.Template = template;
            this.TemplateName = templateName;

            this.Load += new System.EventHandler(this.ImportReceiptDocumentTemplate_Load);
        }
        public frmCSAttendManual(string course_id, int school_year, int semester, int item)
        {
            this.CourseID = course_id;
            this.SchoolYear = school_year;
            this.Semester = semester;
            this.item = item;

            queryHelper = new QueryHelper();
            Access = new AccessHelper();

            InitializeComponent();
        }
Ejemplo n.º 22
0
 private string GetReturnUrl()
 {
     QueryHelper helper = new QueryHelper(this);
     helper.Push("ordnum", this.txtOrderNumber.Text.Trim());
     helper.Push("df", this.txtDateFrom.Text.Trim());
     helper.Push("dt", this.txtDateTo.Text.Trim());
     if (this.chkApproved.Checked) helper.Push("app", "1");
     if (this.chkUnapproved.Checked) helper.Push("unapp", "1");
     helper.Push("pi", this.magicPagerMain.CurrentPageIndex);
     helper.Push("ps", this.magicPagerMain.PageSize);
     return helper.OutputReturnUrl();
 }
        /// <summary>
        /// 取得學生曾經參與過的社團的學年度學期
        /// </summary>
        /// <param name="StudentIdList"></param>
        /// <returns></returns>
        public static Dictionary<string, ValueObj.ClubsVO> GetClubRecordByStudentIdList(List<string> StudentIdList)
        {
            Dictionary<string, ValueObj.ClubsVO> result = new Dictionary<string,ValueObj.ClubsVO>();

            // 社團參與紀錄的取得, 由k12.scjoin.universal改成k12.resultscore.universal, 2013/12/16
            //string tableName1 = "k12.clubrecord.universal";
            //string tableName2 = "k12.scjoin.universal";

            //if (IsUDTExists(tableName1) == false || IsUDTExists(tableName2) == false)
            //{
            //    if (Global.IsDebug) Console.WriteLine("[GetClubRecordByStudentIdList] UDT for Club not found!!");
            //    return result;
            //}

            //StringBuilder sb = new StringBuilder();
            //sb.Append("select t1.school_year, t1.semester, t2.ref_student_id");
            //sb.Append(" from $" + tableName1 + " t1, $" + tableName2 + " t2");
            //sb.Append(" where t2.ref_club_id::int = t1.uid");
            //sb.Append(" and t2.ref_student_id in ('" + string.Join("','", StudentIdList.ToArray()) + "')");
            //sb.Append(" and t1.school_year is not NULL");
            //sb.Append(" and t1.semester is not NULL");

            string tableName = "k12.resultscore.universal";
            if (IsUDTExists(tableName) == false)
            {
                if (Global.IsDebug) Console.WriteLine("[GetClubRecordByStudentIdList] UDT(" + tableName + ") for Club not found!!");
                return result;
            }

            StringBuilder sb = new StringBuilder();
            sb.Append("select t.school_year, t.semester, t.ref_student_id");
            sb.Append(" from $" + tableName + " t");
            sb.Append(" where t.ref_student_id in ('" + string.Join("','", StudentIdList.ToArray()) + "')");
            sb.Append(" and t.school_year is not NULL");
            sb.Append(" and t.semester is not NULL");

            if (Global.IsDebug) Console.WriteLine("[GetClubRecordByStudentIdList] sql: [" + sb.ToString() + "]");
            
            QueryHelper qh = new QueryHelper();
            DataTable dt = qh.Select(sb.ToString());

            foreach (DataRow row in dt.Rows)
            {
                string studentId = ("" + row["ref_student_id"]).Trim();
                if(!result.ContainsKey(studentId))
                    result.Add(studentId, new ValueObj.ClubsVO());

                result[studentId].AddClub(row);
            }

            return result;
        }
Ejemplo n.º 24
0
 /// <summary>
 /// 班座排序
 /// </summary>
 /// <param name="StudIDList"></param>
 /// <returns></returns>
 public static List<string> GetStudentIDListByStudentID(List<string> StudIDList)
 {
     List<string> retVal = new List<string>();
     if (StudIDList.Count > 0)
     {
         QueryHelper qh = new QueryHelper();
         string strSQL = "select student.id from student left join class on student.ref_class_id=class.id where student.id in(" + string.Join(",", StudIDList.ToArray()) + ") order by class.class_name,student.seat_no;";
         DataTable dt = qh.Select(strSQL);
         foreach (DataRow dr in dt.Rows)
             retVal.Add(dr[0].ToString());
     }
     return retVal;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// 透過班級ID取得班級內學生狀態一般的學生ID
 /// </summary>
 /// <param name="ClassIDList"></param>
 /// <returns></returns>
 public static List<string> GetStudentIDList1ByClassID(List<string> ClassIDList)
 {
     List<string> retVal = new List<string>();
     if (ClassIDList.Count > 0)
     {
         QueryHelper qh = new QueryHelper();
         string strSQL = "select student.id from student inner join class on student.ref_class_id=class.id where student.status in(1) and class.id in(" + string.Join(",", ClassIDList.ToArray()) + ") order by student_number;";
         DataTable dt = qh.Select(strSQL);
         foreach (DataRow dr in dt.Rows)
             retVal.Add(dr[0].ToString());
     }
     return retVal;
 }
Ejemplo n.º 26
0
    /// <summary>
    /// Collect current query conditions and pager's size and current index.
    /// as return url
    /// </summary>
    /// <returns></returns>
    private string GetReturnUrl()
    {
        QueryHelper helper = new QueryHelper(this);
        helper.GetValue(this.txtName);
        helper.GetValue(this.txtDescription);
        helper.GetValue(this.cklGroupType);
        helper.GetValue(this.txtModifyTime);

        //Pager's Size and Index
        helper.Push("ps", this.magicPagerMain.PageSize);
        helper.Push("pi", this.magicPagerMain.CurrentPageIndex);
        return helper.OutputReturnUrl();
    }
        public frmEMailingLog(string BatchGUID)
        {
            InitializeComponent();

            this.BatchGUID = BatchGUID;
            this.Query = new QueryHelper();
            this.dataTable = new DataTable();

            this.circularProgress.Visible = false;
            this.circularProgress.IsRunning = false;

            this.Load += new EventHandler(Form_Load);
        }
Ejemplo n.º 28
0
        public Tuple <List <InternalPurchaseOrder>, int, Dictionary <string, string> > Read(int Page = 1, int Size = 25, string Order = "{}", string Keyword = null, string Filter = "{}")
        {
            IQueryable <InternalPurchaseOrder> Query = this.dbSet;

            //IQueryable<PurchaseRequest> Query = DUMMY_DATA.AsQueryable();

            Query = Query.Select(s => new InternalPurchaseOrder
            {
                Id   = s.Id,
                UId  = s.UId,
                PONo = s.PONo,
                PRNo = s.PRNo,
                ExpectedDeliveryDate = s.ExpectedDeliveryDate,
                UnitName             = s.UnitName,
                DivisionName         = s.DivisionName,
                CategoryName         = s.CategoryName,
                IsPosted             = s.IsPosted,
                CreatedBy            = s.CreatedBy,
                PRDate          = s.PRDate,
                LastModifiedUtc = s.LastModifiedUtc,
                PRId            = s.PRId,
                Remark          = s.Remark,
                Items           = s.Items
                                  .Select(
                    q => new InternalPurchaseOrderItem
                {
                    Id            = q.Id,
                    POId          = q.POId,
                    PRItemId      = q.PRItemId,
                    ProductId     = q.ProductId,
                    ProductName   = q.ProductName,
                    ProductCode   = q.ProductCode,
                    UomId         = q.UomId,
                    UomUnit       = q.UomUnit,
                    Quantity      = q.Quantity,
                    ProductRemark = q.ProductRemark,
                    Status        = q.Status
                }
                    )
                                  .Where(j => j.POId.Equals(s.Id))
                                  .ToList()
            });

            List <string> searchAttributes = new List <string>()
            {
                "PRNo", "CreatedBy", "UnitName", "CategoryName", "DivisionName"
            };

            Query = QueryHelper <InternalPurchaseOrder> .ConfigureSearch(Query, searchAttributes, Keyword);

            Dictionary <string, string> FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Filter);

            Query = QueryHelper <InternalPurchaseOrder> .ConfigureFilter(Query, FilterDictionary);

            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Order);

            Query = QueryHelper <InternalPurchaseOrder> .ConfigureOrder(Query, OrderDictionary);

            Pageable <InternalPurchaseOrder> pageable = new Pageable <InternalPurchaseOrder>(Query, Page - 1, Size);
            List <InternalPurchaseOrder>     Data     = pageable.Data.ToList <InternalPurchaseOrder>();
            int TotalData = pageable.TotalCount;

            //var newData = mapper.Map<List<InternalPurchaseOrderViewModel>>(Data);

            //List<object> list = new List<object>();
            //list.AddRange(
            //    newData.AsQueryable().Select(s => new
            //    {
            //        s._id,
            //        s.prNo,
            //        s.poNo,
            //        s.expectedDeliveryDate,
            //        unit = new
            //        {
            //            division = new { s.unit.division.name },
            //            s.unit.name
            //        },
            //        category = new { s.category.name },
            //        s.isPosted,
            //    }).ToList()
            //);

            return(Tuple.Create(Data, TotalData, OrderDictionary));
        }
Ejemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.globalpermissions", "RestoreObjects", SiteContext.CurrentSiteName))
        {
            RedirectToAccessDenied("cms.globalpermissions", "RestoreObjects");
        }

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Async control events binding
        ucAsyncControl.OnFinished += ucAsyncControl_OnFinished;
        ucAsyncControl.OnError    += ucAsyncControl_OnError;

        if (!RequestHelper.IsCallback())
        {
            try
            {
                // Delete temporary files
                ExportProvider.DeleteTemporaryFiles();
            }
            catch (Exception ex)
            {
                DisplayError(ex);
            }

            SetTitle(GetString("RestoreObject.Title"));

            // Get data from parameters
            siteId     = QueryHelper.GetInteger("siteId", 0);
            objectId   = QueryHelper.GetInteger("objectId", 0);
            objectType = QueryHelper.GetString("objectType", "");

            // Get the object
            infoObj = ModuleManager.GetReadOnlyObject(objectType);
            if (infoObj == null)
            {
                lblIntro.Text     = GetString("ExportObject.ObjectTypeNotFound");
                lblIntro.CssClass = "ErrorLabel";
                return;
            }

            // Get exported object
            exportObj = infoObj.GetObject(objectId);
            if (exportObj == null)
            {
                lblIntro.Text      = GetString("ExportObject.ObjectNotFound");
                lblIntro.CssClass  = "ErrorLabel";
                btnRestore.Visible = false;
                return;
            }

            // Store display name
            exportObjectDisplayName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(exportObj.ObjectDisplayName));
            codeName = exportObj.ObjectCodeName;

            lblIntro.Text = string.Format(GetString("RestoreObject.Intro"), exportObjectDisplayName);

            targetFolder = ImportExportHelper.GetObjectBackupFolder(exportObj);

            btnRestore.Click += btnRestore_Click;

            if (!RequestHelper.IsPostBack())
            {
                lblIntro.Visible = true;

                // Load the available backups
                if (lstImports.Items.Count == 0)
                {
                    RefreshPackageList();
                }
            }
        }
    }
Ejemplo n.º 30
0
 public void QueryHelper_GetScalar_ArgumentNullException()
 {
     QueryHelper.GetScalar <int>(null);
 }
Ejemplo n.º 31
0
    /// <summary>
    /// Returns query string which will be passed to the CMS dialogs (Insert image or media/Insert link).
    /// </summary>
    /// <param name="config">Dialog configuration</param>
    /// <param name="selectedPathPrefix">Path prefix of selected value</param>
    public string GetDialogURL(FileSystemDialogConfiguration config, string selectedPathPrefix)
    {
        StringBuilder builder = new StringBuilder();

        // Set constraints
        // Allowed files extensions
        if (!String.IsNullOrEmpty(config.AllowedExtensions))
        {
            builder.Append("&allowed_extensions=" + Server.UrlEncode(config.AllowedExtensions));
        }

        // New text file extension
        if (!String.IsNullOrEmpty(config.NewTextFileExtension))
        {
            builder.Append("&newfile_extension=" + Server.UrlEncode(config.NewTextFileExtension));
        }

        // Excluded extensions
        if (!String.IsNullOrEmpty(config.ExcludedExtensions))
        {
            builder.Append("&excluded_extensions=" + Server.UrlEncode(config.ExcludedExtensions));
        }

        // Allowed folders
        if (!String.IsNullOrEmpty(config.AllowedFolders))
        {
            builder.Append("&allowed_folders=" + Server.UrlEncode(config.AllowedFolders));
        }

        // Excluded folders
        if (!String.IsNullOrEmpty(config.ExcludedFolders))
        {
            builder.Append("&excluded_folders=" + Server.UrlEncode(config.ExcludedFolders));
        }

        // Default path-preselected path in filesystem tree
        if (!String.IsNullOrEmpty(config.DefaultPath))
        {
            builder.Append("&default_path=" + Server.UrlEncode(config.DefaultPath));
        }

        // Deny non-application starting path
        if (!config.AllowNonApplicationPath)
        {
            builder.Append("&allow_nonapp_path=0");
        }

        // Allow manage
        if (config.AllowManage)
        {
            builder.Append("&allow_manage=1");
        }

        // SelectedPath - actual value of textbox
        if (!String.IsNullOrEmpty(config.SelectedPath))
        {
            string selectedPath = config.SelectedPath;
            if (!(selectedPath.StartsWithCSafe("~") || selectedPath.StartsWithCSafe("/") || selectedPath.StartsWithCSafe(".") || selectedPath.StartsWithCSafe("\\")) &&
                ((String.IsNullOrEmpty(config.StartingPath)) || (config.StartingPath.StartsWithCSafe("~"))) && (!String.IsNullOrEmpty(selectedPathPrefix)))
            {
                selectedPath = selectedPathPrefix.TrimEnd('/') + "/" + selectedPath.TrimStart('/');
            }
            builder.Append("&selected_path=" + Server.UrlEncode(selectedPath));
        }

        // Starting path in filesystem
        if (!String.IsNullOrEmpty(config.StartingPath))
        {
            builder.Append("&starting_path=" + Server.UrlEncode(config.StartingPath));
        }

        // Show only folders|files
        builder.Append("&show_folders=" + Server.UrlEncode(config.ShowFolders.ToString()));

        // Editor client id
        if (!String.IsNullOrEmpty(config.EditorClientID))
        {
            builder.Append("&editor_clientid=" + Server.UrlEncode(config.EditorClientID));
        }

        // Get hash for complete query string
        string query = HttpUtility.UrlPathEncode("?" + builder.ToString().TrimStart('&'));

        // Get complete query string with attached hash
        query = URLHelper.AddParameterToUrl(query, "hash", QueryHelper.GetHash(query));

        string baseUrl = "~/CMSFormControls/Selectors/";

        // Get complet URL
        return(ResolveUrl(baseUrl + "SelectFileOrFolder/Default.aspx" + query));
    }
Ejemplo n.º 32
0
 public void MetaData_AfterLink()
 {
     Meta = MetaData.GetMetaData(this);
     QHC  = new CQueryHelper();
     QHS  = Meta.Conn.GetQueryHelper();
 }
Ejemplo n.º 33
0
 public void QueryHelper_SelectRecordItems_Table_Exceptions()
 {
     Assert.ThrowsException <ArgumentNullException>(() => QueryHelper.SelectRecordItems(null, "TableName"));
     Assert.ThrowsException <ArgumentException>(() => QueryHelper.SelectRecordItems(new Record[0], ""));
 }
Ejemplo n.º 34
0
 public void QueryHelper_Flatten_ArgumentNullException()
 {
     QueryHelper.Flatten(null);
 }
Ejemplo n.º 35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterJQuery(this);

        // Get tax class Id from URL
        mTaxClassId = QueryHelper.GetInteger("taxclassid", 0);

        mTaxClassObj = TaxClassInfoProvider.GetTaxClassInfo(mTaxClassId);
        EditedObject = mTaxClassObj;
        // Check if configured tax class belongs to configured site
        if (mTaxClassObj != null)
        {
            // Check site id of tax class
            CheckEditedObjectSiteID(mTaxClassObj.TaxClassSiteID);

            currencyCode = CurrencyInfoProvider.GetMainCurrencyCode(mTaxClassObj.TaxClassSiteID);

            // Check presence of main currency
            string currencyWarning = CheckMainCurrency(mTaxClassObj.TaxClassSiteID);
            if (!string.IsNullOrEmpty(currencyWarning))
            {
                ShowWarning(currencyWarning, null, null);
            }
        }

        if (!RequestHelper.IsPostBack())
        {
            // Fill the drpCountry with countries which have some states or colonies
            drpCountry.DataSource     = CountryInfoProvider.GetCountriesWithStates();
            drpCountry.DataValueField = "CountryID";
            drpCountry.DataTextField  = "CountryDisplayName";
            drpCountry.DataBind();
        }
        // Set grid view properties
        gvStates.Columns[0].HeaderText = GetString("taxclass_state.gvstates.state");
        gvStates.Columns[1].HeaderText = GetString("Code");
        gvStates.Columns[2].HeaderText = GetString("taxclass_state.gvstates.value");
        gvStates.Columns[3].HeaderText = GetString("taxclass_state.gvstates.isflat");
        gvStates.Columns[4].HeaderText = GetString("StateId");

        gvStates.GridLines = GridLines.Horizontal;

        LoadGridViewData();

        // Init scripts
        string currencySwitchScript = string.Format(@"
function switchCurrency(isFlatValue, labelId){{
  if(isFlatValue)
  {{
    jQuery('#'+labelId).html('({0})');
  }}else{{
    jQuery('#'+labelId).html('(%)');
  }}
}}", ScriptHelper.GetString(currencyCode, false));

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "CurrencySwitch", currencySwitchScript, true);
        ScriptHelper.RegisterStartupScript(this, typeof(string), "InitializeGrid", "jQuery('input[id*=\"chkIsFlatValue\"]').change();", true);

        mSave = GetString("general.save");

        // Set header actions
        string[,] actions = new string[1, 10];

        actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1] = GetString("Header.Settings.SaveChanged");
        actions[0, 2] = String.Empty;
        actions[0, 3] = String.Empty;
        actions[0, 4] = String.Empty;
        actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6] = "save";
        actions[0, 8] = true.ToString();

        // Init master page
        CurrentMaster.HeaderActions.Actions          = actions;
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        CurrentMaster.DisplaySiteSelectorPanel       = true;
    }
Ejemplo n.º 36
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        // Hide hidden button
        hdnPostback.Style.Add("display", "none");

        // Do not process special actions if there is no form
        if (Form == null)
        {
            return;
        }

        // ItemValue is GUID or file name (GUID + extension) when working with forms
        if (mValue.LastIndexOfCSafe(".") == -1)
        {
            Guid fileGuid = ValidationHelper.GetGuid(Value, Guid.Empty);
            if (fileGuid != Guid.Empty)
            {
                // Get the file record
                AttachmentInfo ai = Form.GetAttachment(fileGuid);
                if (ai != null)
                {
                    uploader.CurrentFileName = ai.AttachmentName;
                    if (string.IsNullOrEmpty(ai.AttachmentUrl))
                    {
                        uploader.CurrentFileUrl = "~/CMSPages/GetFile.aspx?guid=" + ai.AttachmentGUID;
                    }
                    else
                    {
                        uploader.CurrentFileUrl = ai.AttachmentUrl;
                    }

                    // Register dialog script
                    ScriptHelper.RegisterDialogScript(Page);

                    string jsFuncName;
                    string baseUrl;
                    int    width;
                    int    height;
                    string tooltip;

                    // Image attachment
                    if (ImageHelper.IsSupportedByImageEditor(ai.AttachmentExtension))
                    {
                        // Dialog URL for image editing
                        width      = 905;
                        height     = 670;
                        jsFuncName = "OpenImageEditor";
                        tooltip    = ResHelper.GetString("general.editimage");
                        baseUrl    = string.Format(!IsLiveSite ? "{0}/CMSModules/Content/CMSDesk/Edit/ImageEditor.aspx" : "{0}/CMSFormControls/LiveSelectors/ImageEditor.aspx", URLHelper.GetFullApplicationUrl());
                    }
                    else
                    {
                        // Dialog URL for editing metadata
                        width      = 700;
                        height     = 400;
                        jsFuncName = "OpenMetaEditor";
                        tooltip    = ResHelper.GetString("general.edit");
                        baseUrl    = string.Format(!IsLiveSite ? "{0}/CMSModules/Content/Attachments/Dialogs/MetaDataEditor.aspx" : "{0}/CMSModules/Content/Attachments/CMSPages/MetaDataEditor.aspx", URLHelper.GetFullApplicationUrl());
                    }

                    string script = "function " + jsFuncName + "(attachmentGuid, versionHistoryId, siteId, hash, clientid) {\n modalDialog('" + baseUrl + "?refresh=1&attachmentguid=' + attachmentGuid + (versionHistoryId > 0 ? '&versionhistoryid=' + versionHistoryId : '' ) + '&siteid=' + siteId + '&hash=' + hash + '&clientid=' + clientid, 'imageEditorDialog', " + width + ", " + height + ");\n return false;\n}";

                    // Dialog for attachment editing
                    ScriptHelper.RegisterClientScriptBlock(this, typeof(string), jsFuncName,
                                                           ScriptHelper.GetScript(script));

                    if (Form.Mode != FormModeEnum.InsertNewCultureVersion)
                    {
                        // Create security hash
                        string parameters = "?refresh=1&attachmentGUID=" + ai.AttachmentGUID;
                        if (ai.AttachmentVersionHistoryID > 0)
                        {
                            parameters += "&versionhistoryid=" + ai.AttachmentVersionHistoryID;
                        }
                        parameters += "&siteid=" + ai.AttachmentSiteID;
                        parameters += "&clientid=" + ClientID;

                        string validationHash = QueryHelper.GetHash(parameters);

                        // Setup uploader's action button - it opens image editor when clicked
                        uploader.ActionButton.Attributes.Add("onclick", string.Format("{0}('{1}', {2}, {3}, '{4}', '{5}'); return false;", jsFuncName, ai.AttachmentGUID, ai.AttachmentVersionHistoryID, ai.AttachmentSiteID, validationHash, ClientID));

                        uploader.ActionButton.ToolTip = tooltip;
                        uploader.ShowActionButton     = true;

                        // Initialize refresh script
                        string refresh = string.Format("function InitRefresh_{0}() {{ {1}; if (RefreshTree != null) RefreshTree(); }}", ClientID, Page.ClientScript.GetPostBackEventReference(hdnPostback, "refresh"));
                        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "AttachmentScripts_" + ClientID, ScriptHelper.GetScript(refresh));
                    }
                    else
                    {
                        uploader.ShowActionButton = false;
                    }
                }
            }
        }
        else
        {
            uploader.CurrentFileName = (Form is BizForm) ? ((BizForm)Form).GetFileNameForUploader(mValue) : FormHelper.GetOriginalFileName(mValue);
            uploader.CurrentFileUrl  = "~/CMSPages/GetBizFormFile.aspx?filename=" + FormHelper.GetGuidFileName(mValue) + "&sitename=" + Form.SiteName;
        }

        // Register post back button for update panel
        if (Form.ShowImageButton && Form.SubmitImageButton.Visible)
        {
            ControlsHelper.RegisterPostbackControl(Form.SubmitImageButton);
        }
        else if (Form.SubmitButton.Visible)
        {
            ControlsHelper.RegisterPostbackControl(Form.SubmitButton);
        }
    }
    /// <summary>
    /// Returns all parameters of the selected item as name – value collection.
    /// </summary>
    public override Hashtable GetItemProperties()
    {
        Hashtable retval = new Hashtable();


        #region "Image general tab"

        string ext = ValidationHelper.GetString(ViewState[DialogParameters.URL_EXT], "");
        string url = ValidationHelper.GetString(ViewState[DialogParameters.URL_URL], "");

        if (!(IsRelationship || IsSelectPath))
        {
            bool resolveUrl = (!Config.ContentUseRelativeUrl && !((Config.OutputFormat == OutputFormatEnum.URL) && (Config.SelectableContent == SelectableContentEnum.OnlyMedia)));

            // Exception for MediaSelector control (it can't be resolved)
            url = (resolveUrl ? UrlResolver.ResolveUrl(url) : url);

            if (MediaHelper.IsAudioVideo(ext))
            {
                retval[DialogParameters.AV_URL] = txtUrl.Text.Trim();
            }
            else if (tabImageGeneral.Visible)
            {
                string imgUrl    = txtUrl.Text.Trim();
                bool   sizeToUrl = ValidationHelper.GetBoolean(ViewState[DialogParameters.IMG_SIZETOURL], false);

                if (widthHeightElem.Width < DefaultWidth)
                {
                    retval[DialogParameters.IMG_WIDTH] = widthHeightElem.Width;
                    if (sizeToUrl)
                    {
                        url = URLHelper.AddParameterToUrl(url, "width", widthHeightElem.Width.ToString());
                    }
                }
                if (widthHeightElem.Height < DefaultHeight)
                {
                    retval[DialogParameters.IMG_HEIGHT] = widthHeightElem.Height;
                    if (sizeToUrl)
                    {
                        url = URLHelper.AddParameterToUrl(url, "height", widthHeightElem.Height.ToString());
                    }
                }



                retval[DialogParameters.IMG_URL]          = (resolveUrl ? UrlResolver.ResolveUrl(imgUrl) : imgUrl);
                retval[DialogParameters.IMG_EXT]          = ValidationHelper.GetString(ViewState[DialogParameters.URL_EXT], "");
                retval[DialogParameters.IMG_SIZETOURL]    = sizeToUrl;
                retval[DialogParameters.IMG_ALT]          = txtAlt.Text.Trim();
                retval[DialogParameters.IMG_ALT_CLIENTID] = QueryHelper.GetString(DialogParameters.IMG_ALT_CLIENTID, String.Empty);
            }
        }

        #endregion


        #region "General items"

        retval[DialogParameters.URL_EXT]         = ext;
        retval[DialogParameters.URL_URL]         = url;
        retval[DialogParameters.EDITOR_CLIENTID] = EditorClientID;

        #endregion


        #region "Select path & Relationship items"

        if (IsRelationship || IsSelectPath)
        {
            string path = txtSelectPath.Text;
            if (chkItems.Checked)
            {
                if (!path.EndsWithCSafe("/%"))
                {
                    path = path.TrimEnd('/') + "/%";
                }
            }
            else if (path.EndsWithCSafe("/%"))
            {
                path = path.Substring(0, path.Length - 2);
            }
            retval[DialogParameters.DOC_NODEALIASPATH] = path;

            if (!ContentChanged)
            {
                // Don't set 'content changed' flag
                retval[DialogParameters.CONTENT_CHANGED] = false;
            }

            // Fill target node id only if single path selection is enabled or in relationship dialog
            if (IsSelectSinglePath || IsRelationship)
            {
                retval[DialogParameters.DOC_TARGETNODEID] = ViewState[DialogParameters.DOC_TARGETNODEID];
            }
        }

        #endregion


        return(retval);
    }
Ejemplo n.º 38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        rightHeaderActions.ActionPerformed += RightHeaderActions_ActionPerformed;

        // Show info that scheduler is disabled
        if (!SchedulingHelper.EnableScheduler)
        {
            ShowWarning(GetString("scheduledtask.disabled"));
        }

        listElem.SiteID = SiteID;
        string editUrl = UIContextHelper.GetElementUrl("CMS.ScheduledTasks", GetElementName("EditTask"), true);

        editUrl          = URLHelper.AddParameterToUrl(editUrl, "siteid", SiteID.ToString());
        listElem.EditURL = editUrl;

        // New task action
        HeaderActions.AddAction(new HeaderAction
        {
            Text        = GetString("Task_List.NewItemCaption"),
            RedirectUrl = String.Format(listElem.EditURL, 0)
        });

        // Refresh action
        HeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("General.Refresh"),
            OnClientClick = "RefreshGrid();"
        });

        if (SiteInfo != null)
        {
            bool usesTimer = SchedulingHelper.UseAutomaticScheduler || !SchedulingHelper.RunSchedulerWithinRequest;
            if (usesTimer)
            {
                // Restart timer action
                rightHeaderActions.AddAction(new HeaderAction
                {
                    Text      = GetString("Task_List.Restart"),
                    EventName = TASKS_RESTART_TIMER
                });
            }

            // Run execution ASAP action
            rightHeaderActions.AddAction(new HeaderAction
            {
                Text        = GetString("Task_List.RunNow"),
                EventName   = TASKS_RUN,
                Enabled     = SchedulingHelper.EnableScheduler && (!usesTimer || SchedulingTimer.TimerExists(SiteInfo.SiteName)),
                ButtonStyle = ButtonStyle.Default
            });
        }

        // Reset action to the right
        rightHeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("tasks.resetexecutions"),
            OnClientClick = "if (!confirm(" + ScriptHelper.GetLocalizedString("tasks.resetall") + ")) return false;",
            EventName     = TASKS_RESET,
            ButtonStyle   = ButtonStyle.Default
        });

        // Force action buttons to cause full postback so that tasks can be properly executed in global.asax
        ControlsHelper.RegisterPostbackControl(listElem);
        ControlsHelper.RegisterPostbackControl(rightHeaderActions);

        if (ControlsHelper.CausedPostBack(btnRefresh))
        {
            // Update content after refresh
            pnlUpdate.Update();
        }
        else if (QueryHelper.GetBoolean("reseted", false))
        {
            // Show reset confirmation after reset button action
            ShowConfirmation(GetString("task.executions.reseted"));
        }
    }
    /// <summary>
    /// Page_load event.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions and UI elements
        var user = MembershipContext.AuthenticatedUser;

        if (user != null)
        {
            if (!user.IsAuthorizedPerUIElement("CMS.Users", "CmsDesk.Roles"))
            {
                RedirectToUIElementAccessDenied("CMS.Users", "CmsDesk.Roles");
            }

            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Roles", "Read"))
            {
                RedirectToAccessDenied("CMS.Roles", "Read");
            }
        }

        ScriptHelper.RegisterJQuery(Page);

        // Get user id and site Id from query
        mUserId = QueryHelper.GetInteger("userid", 0);

        // Show content placeholder where site selector can be shown
        CurrentMaster.DisplaySiteSelectorPanel = true;

        if ((SiteID > 0) && !MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
        {
            plcSites.Visible = false;
            CurrentMaster.DisplaySiteSelectorPanel = false;
        }

        if (mUserId > 0)
        {
            // Check that only global administrator can edit global administrator's accounts
            mUserInfo = UserInfo.Provider.Get(mUserId);
            CheckUserAvaibleOnSite(mUserInfo);
            EditedObject = mUserInfo;

            if (!CheckGlobalAdminEdit(mUserInfo))
            {
                plcTable.Visible = false;
                ShowError(GetString("Administration-User_List.ErrorGlobalAdmin"));
                return;
            }

            // Set site selector
            siteSelector.DropDownSingleSelect.AutoPostBack = true;
            siteSelector.AllowAll   = false;
            siteSelector.AllowEmpty = false;

            // Global roles only for global admin
            if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
            {
                siteSelector.AllowGlobal = true;
            }

            // Only sites assigned to user
            siteSelector.UserId           = mUserId;
            siteSelector.OnlyRunningSites = false;
            siteSelector.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

            if (!RequestHelper.IsPostBack())
            {
                mSiteId = SiteContext.CurrentSiteID;

                // If user is member of current site
                if (UserSiteInfo.Provider.Get(mUserId, mSiteId) != null)
                {
                    // Force uniselector to preselect current site
                    siteSelector.Value = mSiteId;
                }

                // Force to load data
                siteSelector.Reload(true);
            }

            // Get truly selected item
            mSiteId = ValidationHelper.GetInteger(siteSelector.Value, 0);
        }

        usRoles.OnSelectionChanged += usRoles_OnSelectionChanged;
        string siteIDWhere = (mSiteId <= 0) ? " SiteID IS NULL " : " SiteID =" + mSiteId;

        usRoles.WhereCondition = siteIDWhere;

        usRoles.SelectItemPageUrl     = "~/CMSModules/Membership/Pages/Users/User_Edit_Add_Item_Dialog.aspx";
        usRoles.ListingWhereCondition = siteIDWhere + " AND UserID=" + mUserId;
        usRoles.ReturnColumnName      = "RoleID";
        usRoles.DynamicColumnName     = false;
        usRoles.GridName               = "User_Role_List.xml";
        usRoles.AdditionalColumns      = "ValidTo";
        usRoles.OnAdditionalDataBound += usMemberships_OnAdditionalDataBound;
        usRoles.DialogWindowHeight     = 760;

        // Exclude generic roles
        string    genericWhere = String.Empty;
        ArrayList genericRoles = RoleInfoProvider.GetGenericRoles();

        if (genericRoles.Count != 0)
        {
            foreach (string role in genericRoles)
            {
                genericWhere += "'" + SqlHelper.EscapeQuotes(role) + "',";
            }

            genericWhere            = genericWhere.TrimEnd(',');
            usRoles.WhereCondition += " AND ( RoleName NOT IN (" + genericWhere + ") )";
        }

        // Get the active roles for this site
        var roleIds = new IDQuery <RoleInfo>().Where(siteIDWhere).Column("RoleID");
        var data    = UserRoleInfo.Provider.Get().WhereEquals("UserID", mUserId).And().WhereIn("RoleID", roleIds).Columns("RoleID").TypedResult;

        if (data.Any())
        {
            mCurrentValues = TextHelper.Join(";", data.Select(i => i.RoleID));
        }

        // If not postback or site selection changed
        if (!RequestHelper.IsPostBack() || (mSiteId != Convert.ToInt32(ViewState["rolesOldSiteId"])))
        {
            // Set values
            usRoles.Value = mCurrentValues;
        }

        // Store selected site id
        ViewState["rolesOldSiteId"] = mSiteId;

        string script = "function setNewDateTime(date) {$cmsj('#" + hdnDate.ClientID + "').val(date);}";

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "key", ScriptHelper.GetScript(script));

        string eventTarget   = Request[postEventSourceID];
        string eventArgument = Request[postEventArgumentID];

        if (eventTarget == ucCalendar.DateTimeTextBox.UniqueID)
        {
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Users", "ManageUserRoles"))
            {
                RedirectToAccessDenied("CMS.Users", "Manage user roles");
            }

            int id = ValidationHelper.GetInteger(hdnDate.Value, 0);
            if (id != 0)
            {
                DateTime     dt  = ValidationHelper.GetDateTime(eventArgument, DateTimeHelper.ZERO_TIME);
                UserRoleInfo uri = UserRoleInfo.Provider.Get(mUserId, id);
                if (uri != null)
                {
                    uri.ValidTo = dt;
                    UserRoleInfo.Provider.Set(uri);

                    // Invalidate user
                    UserInfoProvider.InvalidateUser(mUserId);

                    ShowChangesSaved();
                }
            }
        }
    }
        public ReadResponse <DailyBankTransactionModel> Read(int page, int size, string order, List <string> select, string keyword, string filter)
        {
            IQueryable <DailyBankTransactionModel> Query = _DbSet;

            Query = Query
                    .Select(s => new DailyBankTransactionModel
            {
                Id                        = s.Id,
                CreatedUtc                = s.CreatedUtc,
                Code                      = s.Code,
                LastModifiedUtc           = s.LastModifiedUtc,
                AccountBankName           = s.AccountBankName,
                AccountBankAccountName    = s.AccountBankAccountName,
                AccountBankAccountNumber  = s.AccountBankAccountNumber,
                AccountBankCode           = s.AccountBankCode,
                AccountBankCurrencyCode   = s.AccountBankCurrencyCode,
                AccountBankCurrencyId     = s.AccountBankCurrencyId,
                AccountBankCurrencySymbol = s.AccountBankCurrencySymbol,
                AccountBankId             = s.AccountBankId,
                Date                      = s.Date,
                ReferenceNo               = s.ReferenceNo,
                ReferenceType             = s.ReferenceType,
                Status                    = s.Status,
                SourceType                = s.SourceType,
                IsPosted                  = s.IsPosted
            });

            List <string> searchAttributes = new List <string>()
            {
                "Code", "ReferenceNo", "ReferenceType", "AccountBankName", "AccountBankCurrencyCode", "Status", "SourceType"
            };

            Query = QueryHelper <DailyBankTransactionModel> .Search(Query, searchAttributes, keyword);

            Dictionary <string, object> FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, object> >(filter);

            Query = QueryHelper <DailyBankTransactionModel> .Filter(Query, FilterDictionary);

            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(order);

            Query = QueryHelper <DailyBankTransactionModel> .Order(Query, OrderDictionary);

            Pageable <DailyBankTransactionModel> pageable = new Pageable <DailyBankTransactionModel>(Query, page - 1, size);
            List <DailyBankTransactionModel>     Data     = pageable.Data.ToList();

            List <DailyBankTransactionModel> list = new List <DailyBankTransactionModel>();

            list.AddRange(
                Data.Select(s => new DailyBankTransactionModel
            {
                Id                        = s.Id,
                CreatedUtc                = s.CreatedUtc,
                Code                      = s.Code,
                LastModifiedUtc           = s.LastModifiedUtc,
                AccountBankName           = s.AccountBankName,
                AccountBankAccountName    = s.AccountBankAccountName,
                AccountBankAccountNumber  = s.AccountBankAccountNumber,
                AccountBankCode           = s.AccountBankCode,
                AccountBankCurrencyCode   = s.AccountBankCurrencyCode,
                AccountBankCurrencyId     = s.AccountBankCurrencyId,
                AccountBankCurrencySymbol = s.AccountBankCurrencySymbol,
                AccountBankId             = s.AccountBankId,
                Date                      = s.Date,
                ReferenceNo               = s.ReferenceNo,
                ReferenceType             = s.ReferenceType,
                Status                    = s.Status,
                SourceType                = s.SourceType,
                IsPosted                  = s.IsPosted
            }).ToList()
                );

            int TotalData = pageable.TotalCount;

            return(new ReadResponse <DailyBankTransactionModel>(list, TotalData, OrderDictionary, new List <string>()));
        }
Ejemplo n.º 41
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (CMSContext.CurrentUser.IsAuthenticated())
            {
                // Get requested action
                action     = (FriendsActionEnum)Enum.Parse(typeof(FriendsActionEnum), QueryHelper.GetString("action", "request"), true);
                friendship = CommunityContext.CurrentFriendship;
                friend     = CommunityContext.CurrentFriend;

                // Prepare My Friends link
                lnkMyFriends.Text = MyFriendsCaption;
                if (MyFriendsPath != string.Empty)
                {
                    lnkMyFriends.NavigateUrl = URLHelper.GetAbsoluteUrl(TreePathUtils.GetUrl(MyFriendsPath));
                }
                else
                {
                    lnkMyFriends.Visible = false;
                }

                // Validate requested action
                if (!ValidateAction())
                {
                    return;
                }

                btnApprove.Click += btnApprove_Click;
                btnReject.Click  += btnReject_Click;

                if (friendship != null)
                {
                    // If friendship is rejected -> display error
                    switch (friendship.FriendStatus)
                    {
                    case FriendshipStatusEnum.Rejected:
                        plcMessage.Visible = true;
                        plcConfirm.Visible = false;
                        lblInfo.Text       = AlreadyRejectedCaption;
                        lblInfo.ForeColor  = Color.Red;
                        break;

                    case FriendshipStatusEnum.Approved:
                        plcMessage.Visible = true;
                        plcConfirm.Visible = false;
                        lblInfo.Text       = AlreadyApprovedCaption;
                        lblInfo.ForeColor  = Color.Red;
                        break;

                    default:
                        plcMessage.Visible = false;
                        plcConfirm.Visible = true;
                        btnApprove.Text    = GetString("general.approve");
                        btnReject.Text     = GetString("general.reject");

                        string profilePath = GroupMemberInfoProvider.GetMemberProfilePath(friend.UserName, CMSContext.CurrentSiteName);
                        string profileUrl  = ResolveUrl(TreePathUtils.GetUrl(profilePath));
                        string link        = "<a href=\"" + profileUrl + "\" >" + HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(friend.UserName, friend.FullName, true)) + "</a>";
                        lblConfirm.Text = string.Format(GetString("friends.approvaltext"), link);
                        break;
                    }
                }
                else
                {
                    Visible = false;
                }
            }
            else
            {
                plcMessage.Visible = true;
                plcConfirm.Visible = false;
                lblInfo.ForeColor  = Color.Red;
                lblInfo.Text       = GetString("friends.notloggedin");
            }
        }
    }
Ejemplo n.º 42
0
 protected void Page_Load(object sender, EventArgs e)
 {
     editElem.ElementID  = QueryHelper.GetInteger("elementid", 0);
     editElem.ResourceID = QueryHelper.GetInteger("moduleid", 0);
 }
Ejemplo n.º 43
0
 public void QueryHelper_GetScalar_InvalidOperationException_RecordCount()
 {
     QueryHelper.GetScalar <int>(new Record[0]);
 }
Ejemplo n.º 44
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.PanelContent.CssClass = "";
        UIHelper.AllowUpdateProgress        = false;

        // Display disabled information
        if (!AnalyticsHelper.AnalyticsEnabled(CMSContext.CurrentSiteName))
        {
            this.pnlDisabled.Visible = true;
            this.lblDisabled.Text    = ResHelper.GetString("WebAnalytics.Disabled");
        }

        ucDisplayReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport;
        pnlDisplayReport.Controls.Add((Control)ucDisplayReport);

        // Text for menu buttons
        mSave       = GetString("general.save");
        mPrint      = GetString("Analytics_Report.Print");
        mDeleteData = GetString("Analytics_Report.ManageData");

        // Images for menu buttons
        imgSave.ImageUrl       = GetImageUrl("CMSModules/CMS_Content/EditMenu/save_small.png");
        imgPrint.ImageUrl      = GetImageUrl("General/printSmall.png");
        imgManageData.ImageUrl = GetImageUrl("CMSModules/CMS_Reporting/managedataSmall.png");

        dataCodeName    = QueryHelper.GetString("dataCodeName", String.Empty);
        reportCodeNames = QueryHelper.GetString("reportCodeName", String.Empty);

        // Control initialization (based on displayed report)
        switch (dataCodeName)
        {
        // Overview
        case "campaign":
            CheckWebAnalyticsUI("campaign.overview");
            ucReportHeader.CampaignAllowAll       = true;
            ucReportHeader.ShowConversionSelector = false;
            break;

        // Conversion count
        case "campconversioncount":
            dataCodeName = "campconversion";
            CheckWebAnalyticsUI("CampaignConversionCount");
            ucReportHeader.CampaignAllowAll = false;
            break;

        // Conversion value
        case "campconversionvalue":
            dataCodeName = "campconversion";
            CheckWebAnalyticsUI("campaignsConversionValue");
            ucReportHeader.CampaignAllowAll = false;
            break;

        // Campaign compare
        case "campaigncompare":
            CheckWebAnalyticsUI("CampaignCompare");
            ucReportHeader.ShowCampaignSelector = false;
            dataCodeName = ucReportHeader.CodeNameByGoal;
            ucReportHeader.ShowGoalSelector = true;
            ucReportHeader.ShowSiteSelector = true;

            // Get table column name
            string name = "analytics.hits";
            switch (ucReportHeader.SelectedGoal.ToLower())
            {
            case "view": name = "analytics.view"; break;

            case "count": name = "conversion.count"; break;

            case "value": name = "om.trackconversionvalue"; break;
            }

            string[,] dynamicMacros = new string[1, 2];
            dynamicMacros[0, 0]     = "ColumnName";
            dynamicMacros[0, 1]     = GetString(name);

            ucDisplayReport.DynamicMacros = dynamicMacros;
            break;

        // Campaign detail
        case "campaigndetails":
            CheckWebAnalyticsUI("CampaignDetails");
            ucReportHeader.ShowConversionSelector = false;
            String selectedCampaign = ValidationHelper.GetString(ucReportHeader.SelectedCampaign, String.Empty);
            reportCodeNames = (selectedCampaign == ucReportHeader.AllRecordValue || selectedCampaign == String.Empty) ? allDetailReport : singleDetailReport;
            ucGraphType.ShowIntervalSelector = false;
            allowNoTimeSelection             = true;
            ucGraphType.AllowEmptyDate       = true;
            break;
        }

        // Set table same first column width for all time
        ucDisplayReport.TableFirstColumnWidth = Unit.Percentage(20);

        // Check 'ManageData' permission
        if (CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData"))
        {
            this.lnkDeleteData.OnClientClick = "modalDialog('" +
                                               ResolveUrl("~/CMSModules/Reporting/WebAnalytics/Analytics_ManageData.aspx") +
                                               "?statcodename=campaigns', 'AnalyticsManageData'," + AnalyticsHelper.MANAGE_WINDOW_WIDTH + ", " + AnalyticsHelper.MANAGE_WINDOW_HEIGHT + "); return false; ";
            this.lnkDeleteData.Visible = true;
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "myModalDialog",
                                               ScriptHelper.GetScript("function myModalDialog(url, name, width, height) { " +
                                                                      "win = window; " +
                                                                      "var dHeight = height; var dWidth = width; " +
                                                                      "if (( document.all )&&(navigator.appName != 'Opera')) { " +
                                                                      "try { win = wopener.window; } catch (e) {} " +
                                                                      "if ( parseInt(navigator.appVersion.substr(22, 1)) < 7 ) { dWidth += 4; dHeight += 58; }; " +
                                                                      "dialog = win.showModalDialog(url, this, 'dialogWidth:' + dWidth + 'px;dialogHeight:' + dHeight + 'px;resizable:yes;scroll:yes'); " +
                                                                      "} else { " +
                                                                      "oWindow = win.open(url, name, 'height=' + dHeight + ',width=' + dWidth + ',toolbar=no,directories=no,menubar=no,modal=yes,dependent=yes,resizable=yes,scroll=yes,scrollbars=yes'); oWindow.opener = this; oWindow.focus(); } } "));
    }
Ejemplo n.º 45
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterWOpenerScript(Page);
        ScriptHelper.RegisterJQuery(Page);

        // Try to get parameters
        string    identificator = QueryHelper.GetString("params", null);
        Hashtable parameters    = (Hashtable)WindowHelper.GetItem(identificator);

        // Validate hash
        if ((QueryHelper.ValidateHash("hash", "selectedvalue")) && (parameters != null))
        {
            int siteid = ValidationHelper.GetInteger(parameters["SiteID"], -1);
            if (siteid != -1)
            {
                AccountHelper.AuthorizedReadAccount(siteid, true);
                if (AccountHelper.AuthorizedModifyAccount(siteid, false) || ContactHelper.AuthorizedModifyContact(siteid, false))
                {
                    contactRoleSelector.SiteID     = siteid;
                    contactRoleSelector.IsLiveSite = ValidationHelper.GetBoolean(parameters["IsLiveSite"], false);
                    contactRoleSelector.UniSelector.DialogWindowName = "SelectContactRole";
                    contactRoleSelector.IsSiteManager = ValidationHelper.GetBoolean(parameters["IsSiteManager"], false);

                    selectionDialog.LocalizeItems = QueryHelper.GetBoolean("localize", true);

                    // Load resource prefix
                    string resourcePrefix = ValidationHelper.GetString(parameters["ResourcePrefix"], "general");

                    // Set the page title
                    string titleText = GetString(resourcePrefix + ".selectitem|general.selectitem");

                    // Validity group text
                    pnlRole.GroupingText = GetString(resourcePrefix + ".contactsrole");

                    CurrentMaster.Title.TitleText = titleText;
                    Page.Title = titleText;

                    string imgPath = ValidationHelper.GetString(parameters["IconPath"], null);
                    if (String.IsNullOrEmpty(imgPath))
                    {
                        string objectType = ValidationHelper.GetString(parameters["ObjectType"], null);

                        CurrentMaster.Title.TitleImage = GetObjectIconUrl(objectType, null);
                    }
                    else
                    {
                        CurrentMaster.Title.TitleImage = imgPath;
                    }

                    // Cancel button
                    btnCancel.ResourceString = "general.cancel";
                    btnCancel.Attributes.Add("onclick", "return US_Cancel();");
                }
                // No permission modify
                else
                {
                    CMSPage.RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyAccount");
                }
            }
            else
            {
                // Redirect to error page
                URLHelper.Redirect(ResolveUrl("~/CMSMessages/Error.aspx?title=" + ResHelper.GetString("dialogs.badhashtitle") + "&text=" + ResHelper.GetString("dialogs.badhashtext")));
            }
        }
    }
        public ReadResponse <object> GetAllByPosition(int Page, int Size, string Order, string Keyword, string Filter)
        {
            IQueryable <PurchasingDocumentExpedition> Query = dbContext.PurchasingDocumentExpeditions;

            Query = Query
                    .Select(s => new PurchasingDocumentExpedition
            {
                Id = s.Id,
                UnitPaymentOrderNo = s.UnitPaymentOrderNo,
                UPODate            = s.UPODate,
                DueDate            = s.DueDate,
                InvoiceNo          = s.InvoiceNo,
                SupplierCode       = s.SupplierCode,
                SupplierName       = s.SupplierName,
                CategoryCode       = s.CategoryCode,
                CategoryName       = s.CategoryName,
                DivisionCode       = s.DivisionCode,
                DivisionName       = s.DivisionName,
                TotalPaid          = s.TotalPaid,
                Currency           = s.Currency,
                Position           = s.Position,
                VerifyDate         = s.VerifyDate,
                Vat             = s.Vat,
                IsPaid          = s.IsPaid,
                PaymentMethod   = s.PaymentMethod,
                Items           = s.Items.Where(w => w.PurchasingDocumentExpeditionId == s.Id).ToList(),
                LastModifiedUtc = s.LastModifiedUtc
            });

            List <string> searchAttributes = new List <string>()
            {
                "UnitPaymentOrderNo", "SupplierName", "DivisionName", "SupplierCode", "InvoiceNo"
            };

            Query = QueryHelper <PurchasingDocumentExpedition> .ConfigureSearch(Query, searchAttributes, Keyword);

            if (Filter.Contains("verificationFilter"))
            {
                Filter = "{}";
                List <ExpeditionPosition> positions = new List <ExpeditionPosition> {
                    ExpeditionPosition.SEND_TO_PURCHASING_DIVISION, ExpeditionPosition.SEND_TO_ACCOUNTING_DIVISION, ExpeditionPosition.SEND_TO_CASHIER_DIVISION
                };
                Query = Query.Where(p => positions.Contains(p.Position));
            }

            Dictionary <string, string> FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Filter);

            Query = QueryHelper <PurchasingDocumentExpedition> .ConfigureFilter(Query, FilterDictionary);

            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Order);

            Query = QueryHelper <PurchasingDocumentExpedition> .ConfigureOrder(Query, OrderDictionary);

            Pageable <PurchasingDocumentExpedition> pageable = new Pageable <PurchasingDocumentExpedition>(Query, Page - 1, Size);
            List <PurchasingDocumentExpedition>     Data     = pageable.Data.ToList();
            int TotalData = pageable.TotalCount;

            List <object> list = new List <object>();

            list.AddRange(Data.Select(s => new
            {
                UnitPaymentOrderId = s.Id,
                s.UnitPaymentOrderNo,
                s.UPODate,
                s.DueDate,
                s.InvoiceNo,
                s.SupplierCode,
                s.SupplierName,
                s.CategoryCode,
                s.CategoryName,
                s.DivisionCode,
                s.DivisionName,
                s.Vat,
                s.IsPaid,
                s.TotalPaid,
                s.Currency,
                s.PaymentMethod,
                Items = s.Items.Select(sl => new
                {
                    UnitPaymentOrderItemId = sl.Id,
                    sl.UnitId,
                    sl.UnitCode,
                    sl.UnitName,
                    sl.ProductId,
                    sl.ProductCode,
                    sl.ProductName,
                    sl.Quantity,
                    sl.Uom,
                    sl.Price
                }).ToList()
            }));

            return(new ReadResponse <object>(list, TotalData, OrderDictionary));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        siteId = QueryHelper.GetInteger("siteid", 0);

        RequiredFieldValidatorCodeName.ErrorMessage    = GetString("Administration-Site_Edit.RequiresCodeName");
        RequiredFieldValidatorDisplayName.ErrorMessage = GetString("Administration-Site_Edit.RequiresDisplayName");
        RequiredFieldValidatorDomainName.ErrorMessage  = GetString("Administration-Site_Edit.RequiresDomainName");

        lblCodeName.Text    = GetString("Site_Edit.CodeName");
        lblDescription.Text = GetString("Site_Edit.Description");
        lblDisplayName.Text = GetString("Site_Edit.DisplayName");
        lblDomainName.Text  = GetString("Site_Edit.DomainName");
        lblCulture.Text     = GetString("Site_Edit.ContentCulture");
        //lblLicenseKey.Text = GetString("Site_Edit.LicenseKey");
        lblCssStyle.Text       = GetString("NewSite_SiteDetails.CssStyle");
        lblEditorStyle.Text    = GetString("Site_Edit.EditorStyleSheet");
        lblVisitorCulture.Text = GetString("Site_Edit.VisitorCulture");
        btnOk.Text             = GetString("general.ok");
        btnChange.Text         = GetString("general.change");

        // Set the culture textbox readonly
        txtCulture.Attributes.Add("readonly", "readonly");

        // Stylesheet selector
        ctrlEditorSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] {
            { GetString("administration-site_edit.sitestylesheet"), "0" }
        };
        ctrlEditorSelectStyleSheet.ReturnColumnName = "StyleSheetID";
        ctrlEditorSelectStyleSheet.SiteId           = siteId;

        ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] {
            { GetString("general.selectnone"), "0" }
        };
        ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID";
        ctrlSiteSelectStyleSheet.SiteId           = siteId;

        ltlScript.Text = ScriptHelper.GetScript(
            "var pageChangeUrl='" + ResolveUrl("~/CMSSiteManager/Sites/CultureChange.aspx") + "'; " +
            "function ChangeCulture(documentChanged){ var hiddenElem = document.getElementById('" + hdnDocumentsChangeChecked.ClientID + "');" +
            "hiddenElem.value = documentChanged;" +
            Page.ClientScript.GetPostBackEventReference(btnHidden, "") + "  } "
            );

        // Initialize culture selector
        cultureSelector.AddDefaultRecord = false;
        cultureSelector.SpecialFields    = new string[, ] {
            { GetString("Site_Edit.Automatic"), "" }
        };
        cultureSelector.SiteID = siteId;

        si = SiteInfoProvider.GetSiteInfo(siteId);
        if (si != null)
        {
            if (!RequestHelper.IsPostBack() && (si.SiteName != null))
            {
                siteName = si.SiteName;

                txtCodeName.Text    = siteName;
                txtDescription.Text = si.Description;
                txtDisplayName.Text = si.DisplayName;
                txtDomainName.Text  = si.DomainName;

                ctrlSiteSelectStyleSheet.Value   = si.SiteDefaultStylesheetID;
                ctrlEditorSelectStyleSheet.Value = si.SiteDefaultEditorStylesheet;

                if (CultureHelper.GetDefaultCulture(siteName) != null)
                {
                    CultureInfo ci = CultureInfoProvider.GetCultureInfo(CultureHelper.GetDefaultCulture(siteName));

                    if (ci != null)
                    {
                        txtCulture.Text = ResHelper.LocalizeString(ci.CultureName);
                        currentCulture  = ci.CultureCode;
                    }
                }

                cultureSelector.Value = si.DefaultVisitorCulture;

                // Check version limitations
                if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
                {
                    ShowError(GetString("licenselimitation.siteculturesexceeded"));
                    cultureSelector.Enabled = false;
                    btnOk.Enabled           = false;
                }
            }
        }

        btnChange.OnClientClick = "OpenCultureChanger('" + siteId + "','" + currentCulture + "'); return false;";
    }
Ejemplo n.º 48
0
        public ReadResponse <object> ReadURNItem(int Page = 1, int Size = 25, string Order = "{}", string Keyword = null, string Filter = "{}")
        {
            IQueryable <GarmentUnitReceiptNote> Query            = dbSet;
            Dictionary <string, string>         FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Filter);

            Query = QueryHelper <GarmentUnitReceiptNote> .ConfigureFilter(Query, FilterDictionary);


            List <string> searchAttributes = new List <string>()
            {
                "URNNo", "UnitName", "SupplierName", "DONo"
            };

            Query = QueryHelper <GarmentUnitReceiptNote> .ConfigureSearch(Query, searchAttributes, Keyword);



            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(Order);

            Query = QueryHelper <GarmentUnitReceiptNote> .ConfigureOrder(Query, OrderDictionary);

            Pageable <GarmentUnitReceiptNote> pageable = new Pageable <GarmentUnitReceiptNote>(Query, Page - 1, Size);
            List <GarmentUnitReceiptNote>     Data     = pageable.Data.ToList();
            int TotalData = pageable.TotalCount;

            var data = Query.SelectMany(x => x.Items.Select(y => new
            {
                x.DOId,
                x.DONo,
                x.URNNo,
                y.URNId,
                y.Id,
                y.RONo,
                y.DODetailId,
                y.EPOItemId,
                y.POItemId,
                y.PRItemId,
                y.ProductId,
                y.ProductName,
                y.ProductCode,
                y.ProductRemark,
                y.OrderQuantity,
                y.SmallQuantity,
                y.DesignColor,
                y.SmallUomId,
                y.SmallUomUnit,
                y.POSerialNumber,
                y.PricePerDealUnit,
                x.DOCurrencyRate,
                y.Conversion,
                y.UomUnit,
                y.UomId,
                y.ReceiptCorrection,
                y.CorrectionConversion,
                Article = dbContext.GarmentExternalPurchaseOrderItems.Where(m => m.Id == y.EPOItemId).Select(d => d.Article).FirstOrDefault()
            })).ToList();

            List <object> ListData = new List <object>(data);

            return(new ReadResponse <object>(ListData, TotalData, OrderDictionary));
        }
        public ReadResponse <VBRealizationDocumentExpeditionModel> ReadVerification(int page, int size, string order, string keyword, VBRealizationPosition position, int vbId, int vbRealizationId, DateTimeOffset?realizationDate, string vbRealizationRequestPerson, int unitId)
        {
            var query = _dbContext.Set <VBRealizationDocumentExpeditionModel>().AsQueryable();

            var idQuery    = query;
            var selectData = idQuery.GroupBy(entity => entity.VBRealizationId)
                             .Select(e => e.OrderByDescending(x => x.Id)
                                     .FirstOrDefault()).ToList();
            var ids = selectData.Select(element => element.Id).ToList();

            query = query.Where(entity => ids.Contains(entity.Id) && (entity.Position == VBRealizationPosition.VerifiedToCashier || entity.Position == VBRealizationPosition.NotVerified));

            if (vbId > 0)
            {
                query = query.Where(entity => entity.VBId == vbId);
            }

            if (vbRealizationId > 0)
            {
                query = query.Where(entity => entity.VBRealizationId == vbRealizationId);
            }

            if (realizationDate.HasValue)
            {
                var date = realizationDate.GetValueOrDefault().AddHours(_identityService.TimezoneOffset * -1);
                query = query.Where(entity => entity.VBRealizationDate.Date == date.Date);
            }

            if (!string.IsNullOrWhiteSpace(vbRealizationRequestPerson))
            {
                query = query.Where(entity => entity.VBRequestName == vbRealizationRequestPerson);
            }

            if (unitId > 0)
            {
                query = query.Where(entity => entity.UnitId == unitId);
            }

            //query = query
            //    .Select(entity => new VBRealizationDocumentExpeditionIndexDto
            //    {
            //        Id = entity.Id,
            //        LastModifiedUtc = entity.LastModifiedUtc,
            //        VBNo = entity.VBNo,
            //        VBRealizationNo = entity.VBRealizationNo,
            //        VBRealizationDate = entity.VBRealizationDate,
            //        VBName = entity.VBRequestName,
            //        UnitId = entity.UnitId,
            //        UnitName = entity.UnitName,
            //        DivisionId = entity.DivisionId,
            //        DivisionName = entity.DivisionName,
            //        Currency

            //    });

            List <string> searchAttributes = new List <string>()
            {
                "VBRealizationNo", "VBRequestName", "UnitName"
            };

            query = QueryHelper <VBRealizationDocumentExpeditionModel> .Search(query, searchAttributes, keyword);

            //var filterDictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(filter);
            //Query = QueryHelper<JournalTransactionModel>.Filter(Query, FilterDictionary);

            var orderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(order);

            query = QueryHelper <VBRealizationDocumentExpeditionModel> .Order(query, orderDictionary);

            var pageable = new Pageable <VBRealizationDocumentExpeditionModel>(query, page - 1, size);
            var data     = pageable.Data.ToList();

            var totalData = pageable.TotalCount;

            return(new ReadResponse <VBRealizationDocumentExpeditionModel>(data, totalData, orderDictionary, new List <string>()));
        }
Ejemplo n.º 50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions for CMS Desk -> Ecommerce
        if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Configuration.ShippingOptions.General"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Configuration.ShippingOptions.General");
        }

        // Required field validator error messages initialization
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");
        rfvName.ErrorMessage        = GetString("COM_ShippingOption_Edit.NameError");
        txtShippingOptionCharge.EmptyErrorMessage      = GetString("COM_ShippingOption_Edit.ChargeError");
        txtShippingOptionCharge.ValidationErrorMessage = GetString("COM_ShippingOption_Edit.ChargePositive");

        // Control initializations
        lblShippingOptionDisplayName.Text = GetString("COM_ShippingOption_Edit.ShippingOptionDisplayNameLabel");
        lblShippingOptionCharge.Text      = GetString("COM_ShippingOption_Edit.ShippingOptionChargeLabel");
        lblShippingOptionName.Text        = GetString("COM_ShippingOption_Edit.ShippingOptionNameLabel");

        btnOk.Text = GetString("General.OK");

        // Get shippingOption id from querystring
        mShippingOptionID = QueryHelper.GetInteger("shippingOptionID", 0);
        mEditedSiteId     = ConfiguredSiteID;
        // Edit shiping option
        if (mShippingOptionID > 0)
        {
            ShippingOptionInfo shippingOptionObj = ShippingOptionInfoProvider.GetShippingOptionInfo(mShippingOptionID);
            EditedObject = shippingOptionObj;

            if (shippingOptionObj != null)
            {
                mEditedSiteId = shippingOptionObj.ShippingOptionSiteID;
                CheckEditedObjectSiteID(mEditedSiteId);

                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(shippingOptionObj);
                    // Show that the shippingOption was created or updated successfully
                    if (QueryHelper.GetString("saved", "") == "1")
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("General.ChangesSaved");
                    }
                }
            }
        }

        // Ensure currency code after price value
        txtShippingOptionCharge.CurrencySiteID = mEditedSiteId;

        // Check presence of main currency
        string currencyErr = CheckMainCurrency(mEditedSiteId);

        if (!string.IsNullOrEmpty(currencyErr))
        {
            // Show message
            lblError.Text    = currencyErr;
            lblError.Visible = true;
        }
    }
Ejemplo n.º 51
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Keep current user object
        var currentUser = MembershipContext.AuthenticatedUser;

        // Title element settings
        titleElem.TitleText = GetString("pm.projecttask.edit");

        ControlsHelper.RegisterPostbackControl(btnOK);

        #region "Header actions"

        if (AuthenticationHelper.IsAuthenticated())
        {
            HeaderAction action = new HeaderAction();
            action.Text        = GetString("pm.projecttask.newpersonal");
            action.CommandName = "new_task";
            actionsElem.AddAction(action);

            HeaderActions.ActionPerformed += actionsElem_ActionPerformed;
            HeaderActions.ReloadData();
        }

        #endregion


        // Switch by display type and set correct list grid name
        switch (TasksDisplayType)
        {
        // Project tasks
        case TasksDisplayTypeEnum.ProjectTasks:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/ProjectTasks.xml";
            pnlListActions.Visible   = false;
            break;

        // Tasks owned by me
        case TasksDisplayTypeEnum.TasksOwnedByMe:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksOwnedByMe.xml";
            break;

        // Tasks assigned to me
        case TasksDisplayTypeEnum.TasksAssignedToMe:
            // Set not specified order by default
            ucTaskList.OrderByType = ProjectTaskOrderByEnum.NotSpecified;
            // If sitename is not defined => display task from all sites => use user order
            if (String.IsNullOrEmpty(SiteName))
            {
                ucTaskList.OrderByType = ProjectTaskOrderByEnum.UserOrder;
            }
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksAssignedToMe.xml";
            break;
        }

        #region "Force edit by TaskID in querystring"

        // Check whether is not postback
        if (!RequestHelper.IsPostBack())
        {
            // Try get value from request stroage which indicates whether force dialog is displayed
            bool isDisplayed = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("cmspmforceitemdisplayed", true), false);

            // Try get task id from querystring
            int forceTaskId = QueryHelper.GetInteger("taskid", 0);
            if ((forceTaskId > 0) && (!isDisplayed))
            {
                ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(forceTaskId);
                ProjectInfo     pi  = ProjectInfoProvider.GetProjectInfo(pti.ProjectTaskProjectID);

                // Check whether task is defined
                // and if is assigned to some project, this project is assigned to current site
                if ((pti != null) && ((pi == null) || (pi.ProjectSiteID == SiteContext.CurrentSiteID)))
                {
                    bool taskIdValid = false;

                    // Switch by display type
                    switch (TasksDisplayType)
                    {
                    // Tasks created by me
                    case TasksDisplayTypeEnum.TasksOwnedByMe:
                        if (pti.ProjectTaskOwnerID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Tasks assigned to me
                    case TasksDisplayTypeEnum.TasksAssignedToMe:
                        if (pti.ProjectTaskAssignedToUserID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Project task
                    case TasksDisplayTypeEnum.ProjectTasks:
                        if (!String.IsNullOrEmpty(ProjectNames) && (pi != null))
                        {
                            string projectNames = ";" + ProjectNames.ToLowerCSafe() + ";";
                            if (projectNames.Contains(";" + pi.ProjectName.ToLowerCSafe() + ";"))
                            {
                                // Check whether user can see private task
                                if (!pti.ProjectTaskIsPrivate ||
                                    ((pti.ProjectTaskOwnerID == currentUser.UserID) || (pti.ProjectTaskAssignedToUserID == currentUser.UserID)) ||
                                    ((pi.ProjectGroupID > 0) && currentUser.IsGroupAdministrator(pi.ProjectGroupID)) ||
                                    ((pi.ProjectGroupID == 0) && (currentUser.IsAuthorizedPerResource("CMS.ProjectManagement", PERMISSION_MANAGE))))
                                {
                                    taskIdValid = true;
                                }
                            }
                        }
                        break;
                    }

                    bool displayValid = true;

                    // Check whether do not display finished tasks is required
                    if (!ShowFinishedTasks)
                    {
                        ProjectTaskStatusInfo ptsi = ProjectTaskStatusInfoProvider.GetProjectTaskStatusInfo(pti.ProjectTaskStatusID);
                        if ((ptsi != null) && (ptsi.TaskStatusIsFinished))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether private task should be edited
                    if (!ShowPrivateTasks)
                    {
                        if (pti.ProjectTaskProjectID == 0)
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether ontime task should be edited
                    if (!ShowOnTimeTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline < DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether overdue task should be edited
                    if (!ShowOverdueTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline > DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether user is allowed to see project
                    if ((pi != null) && (ProjectInfoProvider.IsAuthorizedPerProject(pi.ProjectID, ProjectManagementPermissionType.READ, MembershipContext.AuthenticatedUser)))
                    {
                        displayValid = false;
                    }

                    // If task is valid and user has permissions to see this task display edit task dialog
                    if (displayValid && taskIdValid && ProjectTaskInfoProvider.IsAuthorizedPerTask(forceTaskId, ProjectManagementPermissionType.READ, MembershipContext.AuthenticatedUser, SiteContext.CurrentSiteID))
                    {
                        ucTaskEdit.ItemID = forceTaskId;
                        ucTaskEdit.ReloadData();
                        // Render dialog
                        ucPopupDialog.Visible = true;
                        ucPopupDialog.Show();
                        // Set "force dialog displayed" flag
                        RequestStockHelper.Add("cmspmforceitemdisplayed", true, true);
                    }
                }
            }
        }

        #endregion


        #region "Event handlers registration"

        // Register list action handler
        ucTaskList.OnAction += ucTaskList_OnAction;

        #endregion


        #region "Pager settings"

        // Paging
        if (!EnablePaging)
        {
            ucTaskList.Grid.PageSize = "##ALL##";
            ucTaskList.Grid.Pager.DefaultPageSize = -1;
        }
        else
        {
            ucTaskList.Grid.Pager.DefaultPageSize = PageSize;
            ucTaskList.Grid.PageSize    = PageSize.ToString();
            ucTaskList.Grid.FilterLimit = PageSize;
        }

        #endregion


        // Use postbacks on list actions
        ucTaskList.UsePostbackOnEdit = true;
        // Check delete permission
        ucTaskList.OnCheckPermissionsExtended += ucTaskList_OnCheckPermissionsExtended;
        // Dont register JS edit script
        ucTaskList.RegisterEditScript = false;

        // Hide default ok button on edit
        ucTaskEdit.ShowOKButton = false;
        // Disable on site validators
        ucTaskEdit.DisableOnSiteValidators = true;
        // Check modify permission
        ucTaskEdit.OnCheckPermissionsExtended += ucTaskEdit_OnCheckPermissionsExtended;
        // Build condition event
        ucTaskList.BuildCondition += ucTaskList_BuildCondition;
    }
Ejemplo n.º 52
0
 protected override void OnPreInit(EventArgs e)
 {
     CustomerID = QueryHelper.GetInteger("customerid", 0);
     base.OnPreInit(e);
 }
Ejemplo n.º 53
0
    /// <summary>
    /// Saves webpart properties.
    /// </summary>
    public bool Save()
    {
        // Check MVT/CP security
        if (VariantID > 0)
        {
            // Check OnlineMarketing permissions.
            if (!CheckPermissions("Manage"))
            {
                ShowError("general.modifynotallowed");
                return(false);
            }
        }

        // Save the data
        if ((pi != null) && (pti != null) && (templateInstance != null) && SaveForm(form))
        {
            if (SynchronizationHelper.IsCheckedOutByOtherUser(pti))
            {
                string   userName = null;
                UserInfo ui       = UserInfoProvider.GetUserInfo(pti.Generalized.IsCheckedOutByUserID);
                if (ui != null)
                {
                    userName = HTMLHelper.HTMLEncode(ui.GetFormattedUserName(IsLiveSite));
                }

                ShowError(string.Format(GetString("ObjectEditMenu.CheckedOutByAnotherUser"), pti.TypeInfo.ObjectType, pti.DisplayName, userName));
                return(false);
            }

            // Add web part if new
            if (IsNewWebPart)
            {
                int webpartId = ValidationHelper.GetInteger(WebPartID, 0);

                // Ensure layout zone flag
                if (QueryHelper.GetBoolean("layoutzone", false))
                {
                    WebPartZoneInstance zone = pti.TemplateInstance.EnsureZone(ZoneID);
                    zone.LayoutZone = true;
                }

                webPartInstance = PortalHelper.AddNewWebPart(webpartId, ZoneID, false, ZoneVariantID, Position, templateInstance);

                // Set default layout
                if (wpi.WebPartParentID > 0)
                {
                    WebPartLayoutInfo wpli = WebPartLayoutInfoProvider.GetDefaultLayout(wpi.WebPartID);
                    if (wpli != null)
                    {
                        webPartInstance.SetValue("WebPartLayout", wpli.WebPartLayoutCodeName);
                    }
                }
            }

            webPartInstance.XMLVersion = 1;
            if (IsNewVariant)
            {
                webPartInstance             = webPartInstance.Clone();
                webPartInstance.VariantMode = VariantModeFunctions.GetVariantModeEnum(QueryHelper.GetString("variantmode", String.Empty).ToLowerCSafe());
            }

            // Get basic form's data row and update web part
            SaveFormToWebPart(form);

            // Set new position if set
            if (PositionLeft > 0)
            {
                webPartInstance.SetValue("PositionLeft", PositionLeft);
            }
            if (PositionTop > 0)
            {
                webPartInstance.SetValue("PositionTop", PositionTop);
            }

            // Ensure the data source web part instance in the main web part
            if (NestedWebPartID > 0)
            {
                webPartInstance.WebPartType = wpi.WebPartName;
                mainWebPartInstance.NestedWebParts[NestedWebPartKey] = webPartInstance;
            }

            bool isWebPartVariant = (VariantID > 0) || (ZoneVariantID > 0) || IsNewVariant;
            if (!isWebPartVariant)
            {
                // Save the changes
                CMSPortalManager.SaveTemplateChanges(pi, templateInstance, WidgetZoneTypeEnum.None, ViewModeEnum.Design, tree);
            }
            else
            {
                Hashtable varProperties = WindowHelper.GetItem("variantProperties") as Hashtable;
                // Save changes to the web part variant
                VariantHelper.SaveWebPartVariantChanges(webPartInstance, VariantID, ZoneVariantID, VariantMode, varProperties);
            }

            // Reload the form (because of macro values set only by JS)
            form.ReloadData();

            // Clear the cached web part
            CacheHelper.TouchKey("webpartinstance|" + InstanceGUID.ToString().ToLowerCSafe());

            ShowChangesSaved();

            return(true);
        }
        else if ((mainWebPartInstance != null) && (mainWebPartInstance.ParentZone != null) && (mainWebPartInstance.ParentZone.ParentTemplateInstance != null))
        {
            // Reload the zone/web part variants when saving of the form fails
            mainWebPartInstance.ParentZone.ParentTemplateInstance.LoadVariants(true, VariantModeEnum.None);
        }

        return(false);
    }
Ejemplo n.º 54
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Init actions
        // Page view
        if (HeaderActions != null)
        {
            HeaderActions.ActionPerformed += HeaderActionsOnActionPerformed;
            InitHeaderActions();
        }
        // Widget view
        else
        {
            InitButtons();
        }

        timRefresh.Interval = 1000 * ValidationHelper.GetInteger(drpRefresh.SelectedValue, 0);
        isSeparatedDB       = SqlInstallationHelper.DatabaseIsSeparated();

        // Check permissions
        RaiseOnCheckPermissions("READ", this);

        if (StopProcessing)
        {
            return;
        }

        Statistics.EvaluateRequests();

        // Do not count this page with async postback
        if (RequestHelper.IsAsyncPostback())
        {
            RequestHelper.TotalSystemPageRequests.Decrement(null);
        }

        lblServerName.Text             = GetString("Administration-System.ServerName");
        lblServerVersion.Text          = GetString("Administration-System.ServerVersion");
        lblDBName.Text                 = GetString("Administration-System.DatabaseName");
        lblDBSize.Text                 = GetString("Administration-System.DatabaseSize");
        lblMachineName.Text            = GetString("Administration-System.MachineName");
        lblMachineNameValue.Text       = HTMLHelper.HTMLEncode(SystemContext.MachineName);
        lblAspAccount.Text             = GetString("Administration-System.Account");
        lblValueAspAccount.Text        = HTMLHelper.HTMLEncode(WindowsIdentity.GetCurrent().Name);
        plcSeparatedName.Visible       = isSeparatedDB;
        plcSeparatedServerName.Visible = isSeparatedDB;
        plcSeparatedSize.Visible       = isSeparatedDB;
        plcSeparatedVersion.Visible    = isSeparatedDB;
        plcSeparatedHeader.Visible     = isSeparatedDB;

        lblAspVersion.Text      = GetString("Administration-System.Version");
        lblValueAspVersion.Text = HTMLHelper.HTMLEncode(Environment.Version.ToString());

        lblAlocatedMemory.Text = GetString("Administration-System.Memory");
        lblPeakMemory.Text     = GetString("Administration-System.PeakMemory");
        lblVirtualMemory.Text  = GetString("Administration-System.VirtualMemory");
        lblPhysicalMemory.Text = GetString("Administration-System.PhysicalMemory");
        lblIP.Text             = GetString("Administration-System.IP");

        lblPageViewsValues.Text = GetString("Administration-System.PageViewsValues");

        lblPages.Text         = GetString("Administration-System.Pages");
        lblSystemPages.Text   = GetString("Administration-System.SystemPages");
        lblNonPages.Text      = GetString("Administration-System.NonPages");
        lblGetFilePages.Text  = GetString("Administration-System.GetFilePages");
        lblPagesNotFound.Text = GetString("Administration-System.PagesNotFound");
        lblPending.Text       = GetString("Administration-System.Pending");

        lblCacheExpired.Text    = GetString("Administration-System.CacheExpired");
        lblCacheRemoved.Text    = GetString("Administration-System.CacheRemoved");
        lblCacheUnderused.Text  = GetString("Administration-System.CacheUnderused");
        lblCacheItems.Text      = GetString("Administration-System.CacheItems");
        lblCacheDependency.Text = GetString("Administration-System.CacheDependency");

        LoadData();

        if (!RequestHelper.IsPostBack())
        {
            switch (QueryHelper.GetString("lastaction", String.Empty).ToLowerCSafe())
            {
            case "restarted":
                ShowConfirmation(GetString("Administration-System.RestartSuccess"));
                break;

            case "webfarmrestarted":
                if (ValidationHelper.ValidateHash("WebfarmRestarted", QueryHelper.GetString("restartedhash", String.Empty), new HashSettings("")))
                {
                    ShowConfirmation(GetString("Administration-System.WebframRestarted"));
                    // Restart other servers - create webfarm task for application restart
                    WebFarmHelper.CreateTask(new RestartApplicationWebFarmTask());
                }
                else
                {
                    ShowError(GetString("general.actiondenied"));
                }
                break;

            case "countercleared":
                ShowConfirmation(GetString("Administration-System.CountersCleared"));
                break;

            case "winservicesrestarted":
                ShowConfirmation(GetString("Administration-System.WinServicesRestarted"));
                break;
            }
        }

        lblRunTime.Text    = GetString("Administration.System.RunTime");
        lblServerTime.Text = GetString("Administration.System.ServerTime");

        // Remove milliseconds from the end of the time string
        string timeSpan = (DateTime.Now - CMSApplication.ApplicationStart).ToString();
        int    index    = timeSpan.LastIndexOfCSafe('.');

        if (index >= 0)
        {
            timeSpan = timeSpan.Remove(index);
        }

        // Display application run time
        lblRunTimeValue.Text    = timeSpan;
        lblServerTimeValue.Text = Convert.ToString(DateTime.Now) + " " + TimeZoneHelper.GetUTCStringOffset(TimeZoneHelper.ServerTimeZone);

        lblIPValue.Text = HTMLHelper.HTMLEncode(RequestContext.UserHostAddress);
    }
Ejemplo n.º 55
0
    protected override void OnInit(EventArgs e)
    {
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Check UIProfile
        if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "EditForm");
        }

        base.OnInit(e);

        DocumentManager.OnAfterAction += DocumentManager_OnAfterAction;
        DocumentManager.OnLoadData    += DocumentManager_OnLoadData;

        // Register scripts
        string script = "function " + formElem.ClientID + "_RefreshForm(){" + Page.ClientScript.GetPostBackEventReference(btnRefresh, "") + " }";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), formElem.ClientID + "_RefreshForm", ScriptHelper.GetScript(script));

        ScriptHelper.RegisterCompletePageScript(this);
        ScriptHelper.RegisterProgress(this);
        ScriptHelper.RegisterDialogScript(this);

        formElem.OnAfterDataLoad += formElem_OnAfterDataLoad;

        // Analyze the action parameter
        switch (Action)
        {
        case "new":
        case "convert":
        {
            newdocument = true;

            // Check if document type is allowed under parent node
            if ((ParentNodeID > 0) && (ClassID > 0))
            {
                // Check class
                ci = DataClassInfoProvider.GetDataClass(ClassID);
                if (ci == null)
                {
                    throw new Exception("[Content/Edit.aspx]: Class ID '" + ClassID + "' not found.");
                }

                if (ci.ClassName.ToLowerCSafe() == "cms.blog")
                {
                    if (!LicenseHelper.LicenseVersionCheck(URLHelper.GetCurrentDomain(), FeatureEnum.Blogs, VersionActionEnum.Insert))
                    {
                        RedirectToAccessDenied(String.Format(GetString("cmsdesk.bloglicenselimits"), ""));
                    }
                }

                if (!LicenseHelper.LicenseVersionCheck(URLHelper.GetCurrentDomain(), FeatureEnum.Documents, VersionActionEnum.Insert))
                {
                    RedirectToAccessDenied(String.Format(GetString("cmsdesk.documentslicenselimits"), ""));
                }

                // Check if need template selection, if so, then redirect to template selection page
                int templateId = TemplateID;
                if (!ProductSection && ci.ClassShowTemplateSelection && (templateId < 0) && (ci.ClassName.ToLowerCSafe() != "cms.menuitem"))
                {
                    URLHelper.Redirect("~/CMSModules/Content/CMSDesk/TemplateSelection.aspx" + URLHelper.Url.Query);
                }

                // Set default template ID
                formElem.DefaultPageTemplateID = (templateId > 0) ? templateId : ci.ClassDefaultPageTemplateID;

                string newClassName = ci.ClassName;
                formElem.FormName = newClassName + ".default";

                DocumentManager.Mode               = FormModeEnum.Insert;
                DocumentManager.ParentNodeID       = ParentNodeID;
                DocumentManager.NewNodeCultureCode = ParentCulture;

                // Set up the document conversion
                int convertDocumentId = QueryHelper.GetInteger("convertdocumentid", 0);
                if (convertDocumentId > 0)
                {
                    DocumentManager.SourceDocumentID = convertDocumentId;
                    DocumentManager.Mode             = FormModeEnum.Convert;
                }

                DocumentManager.NewNodeClassID = ClassID;

                // Check allowed document type
                TreeNode parentNode = DocumentManager.ParentNode;
                if ((parentNode == null) || !DataClassInfoProvider.IsChildClassAllowed(parentNode.GetIntegerValue("NodeClassID", 0), ClassID))
                {
                    AddNotAllowedScript("child");
                }

                if (!currentUser.IsAuthorizedToCreateNewDocument(DocumentManager.ParentNode, DocumentManager.NewNodeClassName))
                {
                    AddNotAllowedScript("new");
                }
            }

            if (RequiresDialog)
            {
                SetTitle("CMSModules/CMS_Content/Menu/New.png", GetString("Content.NewTitle"), null, null);
            }
        }
        break;

        case "newculture":
        {
            newculture = true;
            int nodeId = QueryHelper.GetInteger("nodeid", 0);
            DocumentManager.Mode = FormModeEnum.InsertNewCultureVersion;
            formElem.NodeID      = nodeId;

            // Check permissions
            bool authorized = false;
            if (nodeId > 0)
            {
                // Get the node
                TreeNode treeNode = DocumentManager.Tree.SelectSingleNode(nodeId);
                if (treeNode != null)
                {
                    DocumentManager.NewNodeClassID     = treeNode.GetIntegerValue("NodeClassID", 0);
                    DocumentManager.ParentNodeID       = ParentNodeID;
                    DocumentManager.NewNodeCultureCode = ParentCulture;
                    authorized = currentUser.IsAuthorizedToCreateNewDocument(treeNode.NodeParentID, treeNode.NodeClassName);

                    if (authorized)
                    {
                        string className = DocumentManager.NewNodeClassName;
                        if (className.ToLowerCSafe() == "cms.blog")
                        {
                            if (!LicenseHelper.LicenseVersionCheck(URLHelper.GetCurrentDomain(), FeatureEnum.Blogs, VersionActionEnum.Insert))
                            {
                                RedirectToAccessDenied(String.Format(GetString("cmsdesk.bloglicenselimits"), ""));
                            }
                        }

                        if (!LicenseHelper.LicenseVersionCheck(URLHelper.GetCurrentDomain(), FeatureEnum.Documents, VersionActionEnum.Insert))
                        {
                            RedirectToAccessDenied(String.Format(GetString("cmsdesk.documentslicenselimits"), ""));
                        }

                        // Default data document ID
                        formElem.CopyDefaultDataFromDocumentId = ValidationHelper.GetInteger(Request.QueryString["sourcedocumentid"], 0);

                        ci = DataClassInfoProvider.GetDataClass(className);
                        formElem.FormName = className + ".default";
                    }
                }
            }

            if (!authorized)
            {
                AddNotAllowedScript("newculture");
            }

            if (RequiresDialog)
            {
                SetTitle("CMSModules/CMS_Content/Menu/New.png", GetString("content.newcultureversiontitle"), null, null);
            }
        }
        break;

        default:
        {
            TreeNode node = Node;
            if (node == null)
            {
                RedirectToNewCultureVersionPage();
            }
            else
            {
                // Update view mode
                if (!RequiresDialog)
                {
                    CMSContext.ViewMode = ViewModeEnum.EditForm;
                }

                EnableSplitMode      = true;
                DocumentManager.Mode = FormModeEnum.Update;
                ci = DataClassInfoProvider.GetDataClass(node.NodeClassName);
                if (RequiresDialog)
                {
                    menuElem.ShowSaveAndClose = true;

                    // Add the document name to the properties header title
                    string nodeName = node.GetDocumentName();
                    // Get name for root document
                    if (node.NodeClassName.ToLowerCSafe() == "cms.root")
                    {
                        nodeName = CMSContext.CurrentSite.DisplayName;
                    }

                    SetTitle("CMSModules/CMS_Content/Menu/New.png", GetString("Content.EditTitle") + " \"" + HTMLHelper.HTMLEncode(ResHelper.LocalizeString(nodeName)) + "\"", null, null);
                }
            }
        }
        break;
        }

        formElem.Visible = true;

        // Display / hide the CK editor toolbar area
        FormInfo fi = FormHelper.GetFormInfo(ci.ClassName, false);

        if (fi.UsesHtmlArea())
        {
            // Add script to display toolbar
            if (formElem.HtmlAreaToolbarLocation.ToLowerCSafe() == "out:cktoolbar")
            {
                mShowToolbar = true;
            }
        }

        // Init form for product section edit
        if (ProductSection)
        {
            // Form prefix
            formElem.FormPrefix = "ecommerce";
        }

        if (RequiresDialog)
        {
            plcCKFooter.Visible = false;
        }
    }
Ejemplo n.º 56
0
    protected void Page_Load(object sender, EventArgs e)
    {
        editGrid.RowDataBound += new GridViewRowEventHandler(editGrid_RowDataBound);

        // Get main currency
        mMainCurrency = CurrencyInfoProvider.GetMainCurrency(this.ConfiguredSiteID);

        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        // Control initializations
        lblExchangeTableValidFrom.Text   = GetString("ExchangeTable_Edit.ExchangeTableValidFromLabel");
        lblExchangeTableDisplayName.Text = GetString("ExchangeTable_Edit.ExchangeTableDisplayNameLabel");
        lblExchangeTableValidTo.Text     = GetString("ExchangeTable_Edit.ExchangeTableValidToLabel");

        // Help image
        this.imgHelp.ImageUrl           = GetImageUrl("General/HelpSmall.png");
        this.imgHelp.ToolTip            = GetString("ExchangeTable_Edit.ExchangeRateHelp");
        this.imgHelpFromGlobal.ImageUrl = GetImageUrl("General/HelpSmall.png");
        this.imgHelpFromGlobal.ToolTip  = GetString("ExchangeTable_Edit.ExchangeRateHelp");

        lblRates.Text = GetString("ExchangeTable_Edit.ExchangeRates");

        btnOk.Text = GetString("General.OK");
        dtPickerExchangeTableValidFrom.SupportFolder = "~/CMSAdminControls/Calendar";
        dtPickerExchangeTableValidTo.SupportFolder   = "~/CMSAdminControls/Calendar";

        string currentTableTitle = GetString("ExchangeTable_Edit.NewItemCaption");

        // Get exchangeTable id from querystring
        mExchangeTableId = QueryHelper.GetInteger("exchangeid", 0);
        if (mExchangeTableId > 0)
        {
            exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(mExchangeTableId);
            EditedObject     = exchangeTableObj;

            if (exchangeTableObj != null)
            {
                // Check tables site id
                CheckEditedObjectSiteID(exchangeTableObj.ExchangeTableSiteID);
                // Set title
                currentTableTitle = exchangeTableObj.ExchangeTableDisplayName;

                LoadData(exchangeTableObj);

                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    // Show that the exchangeTable was created or updated successfully
                    if (QueryHelper.GetString("saved", "") == "1")
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("General.ChangesSaved");
                    }
                }
            }

            this.CurrentMaster.Title.TitleText  = GetString("ExchangeTable_Edit.HeaderCaption");
            this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_ExchangeTable/object.png");

            // Init Copy from global link
            InitCopyFromGlobalLink();
        }
        // Creating a new exchange table
        else
        {
            if (!RequestHelper.IsPostBack())
            {
                // Preset valid from date
                ExchangeTableInfo tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(this.ConfiguredSiteID);
                if (tableInfo != null)
                {
                    dtPickerExchangeTableValidFrom.SelectedDateTime = tableInfo.ExchangeTableValidTo;
                }
            }
            // Grids are visible only in edit mode
            plcGrid.Visible = false;

            this.CurrentMaster.Title.TitleText  = GetString("ExchangeTable_New.HeaderCaption");
            this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_ExchangeTable/new.png");
        }

        // Initializes page title breadcrumbs control
        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("ExchangeTable_Edit.ItemListLink");
        breadcrumbs[0, 1]     = "~/CMSModules/Ecommerce/Pages/Tools/Configuration/ExchangeRates/ExchangeTable_List.aspx?siteId=" + SiteID;
        breadcrumbs[0, 2]     = "";
        breadcrumbs[1, 0]     = currentTableTitle;
        breadcrumbs[1, 1]     = "";
        breadcrumbs[1, 2]     = "";
        this.CurrentMaster.Title.Breadcrumbs = breadcrumbs;

        this.CurrentMaster.Title.HelpTopicName = "new_rateexchange_rate_edit";
        this.CurrentMaster.Title.HelpName      = "helpTopic";

        plcRateFromGlobal.Visible = IsFromGlobalRateNeeded();

        // Check presence of main currency
        string currencyErr = CheckMainCurrency(ConfiguredSiteID);

        if (!string.IsNullOrEmpty(currencyErr))
        {
            // Show message
            lblNoMainCurrency.Text    = currencyErr;
            plcNoMainCurrency.Visible = true;
            plcRates.Visible          = false;
        }
    }
Ejemplo n.º 57
0
 public void QueryHelper_SelectRecordItems_ArgumentNullException()
 {
     QueryHelper.SelectRecordItems(null);
 }
Ejemplo n.º 58
-1
        public static List<StudentInfo> GetStudnetInfoByIDList(List<string> StudIdList)
        {
            List<StudentInfo> result = new List<StudentInfo>();
            QueryHelper qh = new QueryHelper();
            StringBuilder sbQry = new StringBuilder();
            sbQry.Append("'"); sbQry.Append(string.Join("','", StudIdList.ToArray())); sbQry.Append("'");
            string strSQL = "select student.id," +
		                            "student.student_number," +
		                            "student.gender," +
		                            "student.id_number," +
		                            "student.birthdate," +
		                            "class.grade_year," +
		                            "class.class_name," +
                                "student.name," +       // for sort
                                "class.display_order" + // for sort
                            " from student" +
                            " left join class on student.ref_class_id = class.id" +
                            " where student.id in(" + sbQry.ToString() + ") and student.status='1';";
            DataTable dt = qh.Select(strSQL);

            foreach (DataRow dr in dt.Rows)
            {
                StudentInfo studentInfo = new StudentInfo(dr);
                result.Add(studentInfo);
            }

            return result;
        }
        protected override void GenerateTreeStruct(KeyCatalog root)
        {
            QueryHelper query = new QueryHelper();

            string cmd = @"select student.id, dg.name, class.grade_year, student.status, dg.order from student
            left join $ischool.emba.student_brief2 as sb on student.id=sb.ref_student_id
            left join $ischool.emba.department_group dg on dg.uid=sb.ref_department_group_id
            left join class on class.id=student.ref_class_id
            where student.id in(@PrimaryKeys)
            order by dg.order, dg.name, class.grade_year";

            StringBuilder primarykeys = new StringBuilder();
            primarykeys.AppendFormat("{0}", "-1"); //如果沒有資料也不會爆掉。
            foreach (string key in Source)
                primarykeys.AppendFormat(",{0}", key);

            cmd = cmd.Replace("@PrimaryKeys", primarykeys.ToString());

            DataTable result = Backend.Select(cmd);

            //KeyCatalog advisor = root.Subcatalogs["系所組別"];
            //KeyCatalog unadvisor = root.Subcatalogs["未設定系所組"];
            //KeyCatalog deleted = root.Subcatalogs["刪除學生"];

            //設定排序因子。
            //advisor.Tag = 0; //排前面。
            //unadvisor.Tag = 1;
            //deleted.Tag = 2;

            root.Subcatalogs["未設定"].Tag = int.MaxValue;
            foreach (DataRow row in result.Rows)
            {
                string department = (string.IsNullOrEmpty((row["name"] + "")) ? "未設定" : (row["name"] + ""));
                //KeyCatalog dg = advisor.Subcatalogs[department];
                GradeYear gy = GradeYear.ToGradeYear(row["grade_year"] + "");
                //string classid = row["classid"] + "";
                string id = row["id"] + "";
                string stauts = row["status"] + "";

                //root.Subcatalogs[department].AddKey(id);
                //if (stauts == "256")
                //    deleted.AddKey(id);
                //else if (string.IsNullOrWhiteSpace(classid))
                //    unadvisor.AddKey(id);
                //else
                //{
                //if (!root.Subcatalogs[department].Subcatalogs.Contains(gy.ChineseTitle))
                //{
                //指定排序因子。
                if (gy == GradeYear.Undefined) //未分年級要排最後。
                    root.Subcatalogs[department][gy.ChineseTitle].Tag = int.MaxValue;
                else
                {
                    root.Subcatalogs[department].Tag = row["order"] + "";
                    root.Subcatalogs[department][gy.ChineseTitle].Tag = row["grade_year"] + "";
                }
                root.Subcatalogs[department][gy.ChineseTitle].AddKey(id);
                //}
            }
        }
        public GraduationAuditReport(IEnumerable<string> StudentIDs)
        {
            InitializeComponent();

            this.circularProgress.IsRunning = true;
            this.circularProgress.Visible = true;
            this.btnPrint.Enabled = false;

            this.Load += new EventHandler(GraduationAuditReport_Load);

            Access = new AccessHelper();
            Query = new QueryHelper();

            this.dicStudents = new Dictionary<string, StudentRecord>();
            this.dicDepartmentGroups = new Dictionary<string, UDT.DepartmentGroup>();
            this.dicStudentBrief2 = new Dictionary<string, UDT.StudentBrief2>();
            this.dicGraduationRequirements = new Dictionary<string, UDT.GraduationRequirement>();
            this.dicSubjectSemesterScores = new Dictionary<string, List<UDT.SubjectSemesterScore>>();
            this.dicGraduationSubjectGroupRequirements = new Dictionary<int, Dictionary<string, UDT.GraduationSubjectGroupRequirement>>();
            this.dicGraduationSubjectLists = new Dictionary<int, Dictionary<int, UDT.GraduationSubjectList>>();
            this.dicSubjects = new Dictionary<string, UDT.Subject>();

            SubjectGroups_Sort = new List<string>() { "核心必修", "核心選修三選二", "組必修" };

            this.InitSchoolYear();
            this.InitSemester();

            this.InitData(StudentIDs);

            dtDueDate.Value = DateTime.Today;
        }