Пример #1
0
    protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView   grid       = sender as ASPxGridView;
        ASPxHtmlEditor htmlEditor = ASPxGridView1.FindEditFormTemplateControl("ASPxHtmlEditor1") as ASPxHtmlEditor;

        e.NewValues["DescriptionHtml"] = htmlEditor.Html;
    }
Пример #2
0
 void ApplyModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, HtmlEditorCustomDialog htmlEditorCustomDialog)
 {
     ApplyModel(modelHtmlEditor, htmlEditor, ApplyValues);
     ApplyToolbarModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.ToolBars));
     ApplyShortcutModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.Shortcuts));
     ApplyCustomDialodModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.CustomDialogs), htmlEditorCustomDialog);
 }
Пример #3
0
        private ASPxPanel editorSetup()
        {
            ASPxPanel editorPanel = new ASPxPanel();

            editorPanel.Width = Unit.Percentage(100);
            ASPxHtmlEditor htmlPanel = new ASPxHtmlEditor();

            htmlPanel.ID     = "htmlPanel";
            htmlPanel.Height = Unit.Pixel(250);
            htmlPanel.Width  = Unit.Percentage(100);
            htmlPanel.Html   = "<div style=\"font-size: 11px;\"></div>";
            string appDir = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
            string appUrl = HttpContext.Current.Request.Url.Host;
            string imgDir = string.Format("{0}\\{1}", appDir, "Images\\editors");

            if (!System.IO.Directory.Exists(imgDir))
            {
                System.IO.Directory.CreateDirectory(imgDir);
            }

            if (System.IO.Directory.Exists(imgDir))
            {
                htmlPanel.SettingsDialogs.InsertImageDialog.SettingsImageUpload.UploadFolder = "/Images/editors/";  //"./Images/editors"; // imgDir; // UploadImageFolder
            }
            htmlPanel.HtmlChanged += new EventHandler <EventArgs>(htmlPanel_HtmlChanged);
            editorPanel.Controls.Add(htmlPanel);

            return(editorPanel);
        }
Пример #4
0
        protected void gridResponse_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            // String MilestoneID = Session["MilestoneID"].ToString();
            String       ItemID       = Session["ItemKey"].ToString();
            ASPxGridView gridResponse = (ASPxGridView)sender;

            ASPxHtmlEditor txResponse = (ASPxHtmlEditor)gridResponse.FindEditFormLayoutItemTemplateControl("txResponse");

            AssessmentResponse UpdateResponse = new AssessmentResponse
            {
                ResponseID    = Guid.Parse(e.Keys["ResponseID"].ToString()),
                MilestoneName = e.NewValues["MilestoneName"].ToString(),
                ItemKey       = Guid.Parse(ItemID),
                // MilestoneID = Guid.Parse(""),

                Response = txResponse.Html
            };

            rc_services.SaveResponse(UpdateResponse);

            e.Cancel = true;
            gridResponse.DataSource = rc_services.GetResponse(Guid.Parse(ItemID));
            gridResponse.DataBind();
            gridResponse.CancelEdit();

            BindMainGrids();
        }
        public static HtmlEditorSettings SetHtmlEditorExportSettings(HtmlEditorSettings settings)
        {
            settings.Name = "heImportExport";
            settings.CallbackRouteValues = new { Controller = "HtmlEditor", Action = "ImportExportPartial" };
            settings.ExportRouteValues   = new { Controller = "HtmlEditor", Action = "ExportTo" };

            var toolbar = settings.Toolbars.Add();

            toolbar.Items.Add(new ToolbarUndoButton());
            toolbar.Items.Add(new ToolbarRedoButton());
            toolbar.Items.Add(new ToolbarBoldButton(true));
            toolbar.Items.Add(new ToolbarItalicButton());
            toolbar.Items.Add(new ToolbarUnderlineButton());
            toolbar.Items.Add(new ToolbarStrikethroughButton());
            toolbar.Items.Add(new ToolbarInsertImageDialogButton(true));
            ToolbarExportDropDownButton saveButton = new ToolbarExportDropDownButton(true);

            saveButton.CreateDefaultItems();
            toolbar.Items.Add(saveButton);

            settings.PreRender = (sender, e) => {
                ASPxHtmlEditor editor = (ASPxHtmlEditor)sender;
                editor.Width = Unit.Percentage(100);
            };

            return(settings);
        }
Пример #6
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        //(fv.FindControl("form_docvers") as ASPxFormLayout).ForEach(SaveItem);

        //try
        //{
        //	sql_docvers.Update();
        //}
        //catch (Exception ex)
        //{
        //	var x = ex.Message;
        //}


        ASPxTextBox    txt_doctitle     = (ASPxTextBox)this.FindControlRecursive("txt_doctitle");
        ASPxComboBox   cbo_docstatusid  = (ASPxComboBox)this.FindControlRecursive("cbo_docstatusid");
        ASPxHtmlEditor htmledit_docdesc = (ASPxHtmlEditor)this.FindControlRecursive("htmledit_docdesc");


        string docdesc = htmledit_docdesc.Html.ToString();

        string doctitle    = txt_doctitle.Value.ToString();
        string docstatusid = cbo_docstatusid.Value.ToString();

        //if (docdesc != "")
        //      {
        SQL_utils sql  = new SQL_utils("backend");
        string    code = String.Format("update tbldoc set docdesc = '{0}', doctitle='{1}', docstatusid={2} where docid=(select docid from tbldocvers where docversid={3})",
                                       docdesc, doctitle, docstatusid, Request.QueryString["dvID"]);

        sql.NonQuery_from_SQLstring(code);
        sql.Close();
        //}
    }
Пример #7
0
        // Replaces placeholders specified as a dictionary
        protected void Insert_Signature(object sender, EventArgs e)
        {
            string html    = HtmlEditor.Html;
            string newHtml = ASPxHtmlEditor.ReplacePlaceholders(html, PlaceholdersForSignature);

            HtmlEditor.Html = newHtml;
        }
Пример #8
0
        // Replaces placeholders specified as an object
        protected void Insert_Date(object sender, EventArgs e)
        {
            PlaceholdersForDate placeholdersForDate = new PlaceholdersForDate();
            string html    = HtmlEditor.Html;
            string newHtml = ASPxHtmlEditor.ReplacePlaceholders(html, placeholdersForDate);

            HtmlEditor.Html = newHtml;
        }
Пример #9
0
        protected ASPxHtmlEditor CreateChatEditor()
        {
            ASPxHtmlEditor control = new ASPxHtmlEditor();

            control.ID    = "ChatHtmlEditor";
            control.Width = Unit.Percentage(100);
            return(control);
        }
Пример #10
0
    protected void myHtmlEditor_Load(object sender, EventArgs e)
    {
        ASPxHtmlEditor htmlEditor = (ASPxHtmlEditor)sender;

        ASPxSpellCheckerCustomDictionary userDictionary = (ASPxSpellCheckerCustomDictionary)htmlEditor.SettingsSpellChecker.Dictionaries[1];

        userDictionary.CacheKey       = string.Format("dic_{0}", UserName);
        userDictionary.DictionaryPath = string.Format("~/CustomDictionaries/{0}.dic", UserName);
    }
Пример #11
0
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;

        e.NewValues["ID"] = Guid.NewGuid().ToString().Replace("-", "");
        ASPxHtmlEditor htmlEditor = ASPxGridView1.FindEditFormTemplateControl("ASPxHtmlEditor1") as ASPxHtmlEditor;

        e.NewValues["DescriptionHtml"] = htmlEditor.Html;
    }
Пример #12
0
        public static ASPxHtmlEditor AsPxHtmlEditor()
        {
            var htmlEditor = new ASPxHtmlEditor();

            htmlEditor.CreateDefaultToolbars(true);

            CreateInsertFileCommand(htmlEditor);
            return(htmlEditor);
        }
Пример #13
0
        private void editorRender(ref ASPxPanel editorPanel)
        {
            ASPxHtmlEditor htmlPanel = (ASPxHtmlEditor)(editorPanel.FindControl("htmlPanel"));

            if (htmlPanel != null)
            {
                htmlPanel.Html = txtHTML;
            }
        }
    protected void gv_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView       gridView         = sender as ASPxGridView;
        GridViewDataColumn columnRftContent = gridView.Columns["RtfContent"] as GridViewDataColumn;
        ASPxHtmlEditor     htmlEditor       = gridView.FindEditRowCellTemplateControl(columnRftContent, "he") as ASPxHtmlEditor;

        e.NewValues["RtfContent"] = GetRtfTextFromASPxHtmlEditor(htmlEditor);

        throw new InvalidOperationException("Data modifications are not allowed in online demos");
        //Note that data modifications are not allowed in online demos. To allow editing in local/offline mode, download the example and comment out the "throw..." operation in the ASPxGridView.RowUpdating event handler.
    }
    protected void he_Init(object sender, EventArgs e)
    {
        ASPxHtmlEditor htmlEditor = sender as ASPxHtmlEditor;
        GridViewDataItemTemplateContainer container = htmlEditor.NamingContainer as GridViewDataItemTemplateContainer;
        string rtfText = container.Grid.GetRowValues(container.VisibleIndex, "RtfContent").ToString();

        byte[] byteArray = Encoding.ASCII.GetBytes(rtfText);
        using (MemoryStream ms = new MemoryStream(byteArray)) {
            htmlEditor.Import(HtmlEditorImportFormat.Rtf, ms, false, ContentFolder);
        }
    }
Пример #16
0
        void ApplyShortcutModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, string propertyName)
        {
            var editorShortcuts = (IModelHtmlEditorShortcuts)((ModelNode)modelHtmlEditor)[propertyName];

            foreach (var modelShortcut in editorShortcuts)
            {
                var editorShortcut = new HtmlEditorShortcut();
                htmlEditor.Shortcuts.Add(editorShortcut);
                ApplyModel(modelShortcut, editorShortcut, ApplyValues);
            }
        }
Пример #17
0
        public override System.Web.UI.Control Build()
        {
            base.Build();
            ASPxHtmlEditor he = new ASPxHtmlEditor();

            he.Width  = ModuleField.Width;
            he.Height = ModuleField.Height;
            he.SettingsValidation.RequiredField.IsRequired = ModuleField.IsRequired;
            he.SettingsValidation.RequiredField.ErrorText  = ModuleField.ErrorText;
            he.Html = ModuleField.CurrentValue == null ? ModuleField.DefaultValue == null ? null : ModuleField.DefaultValue.ToString() : ModuleField.CurrentValue.ToString();
            return(he);
        }
Пример #18
0
        static void CreateInsertFileCommand(ASPxHtmlEditor htmlEditor)
        {
            var editorToolbar       = htmlEditor.Toolbars.First(toolbar => toolbar.Items.Any(item => item.CommandName == "insertimagedialog"));
            var editorToolbarItem   = editorToolbar.Items.First(item => item.CommandName == "insertimagedialog");
            var index               = editorToolbarItem.Index;
            var customToolbarButton = new ToolbarCustomDialogButton(InsertFileCommand, "Insert File...")
            {
                ViewStyle = ViewStyle.Image
            };

            customToolbarButton.Image.Url = "~/Images/" + InsertFileCommand + ".png";
            editorToolbar.Items.Insert(index, customToolbarButton);
        }
Пример #19
0
        void ApplyCustomDialodModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, string propertyName, HtmlEditorCustomDialog htmlEditorCustomDialog)
        {
            var editorCustomDialogs = (IModelHtmlEditorCustomDialogs)((ModelNode)modelHtmlEditor)[propertyName];

            foreach (var modelCustomDialog in editorCustomDialogs.OfType <ModelNode>())
            {
                var editorCustomDialog = htmlEditor.CustomDialogs[modelCustomDialog.Id];
                if (editorCustomDialog == null)
                {
                    ApplyModel(modelCustomDialog, htmlEditorCustomDialog, ApplyValues);
                }
            }
        }
Пример #20
0
        void ApplyToolbarModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, string propertyName)
        {
            int index    = 0;
            var toolBars = (IModelHtmlEditorToolBars)((ModelNode)modelHtmlEditor)[propertyName];

            foreach (var toolbar in toolBars.ToList())
            {
                var editorToolBar = htmlEditor.Toolbars[toolbar.GetValue <string>("Id")];
                ApplyModel(toolbar, editorToolBar, ApplyValues);
                ApplyToolbarItemModel(toolbar, editorToolBar, index);
                index++;
            }
        }
    private static string GetRtfTextFromASPxHtmlEditor(ASPxHtmlEditor htmlEditor)
    {
        string rtfText;

        using (MemoryStream ms = new MemoryStream()) {
            htmlEditor.Export(HtmlEditorExportFormat.Rtf, ms);
            ms.Flush();
            ms.Position = 0;

            StreamReader reader = new StreamReader(ms);
            rtfText = reader.ReadToEnd();
        }
        return(rtfText);
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Opening Document
            var documentID = Request.QueryString["id"];
            int itemID     = -1;

            int.TryParse(documentID, out itemID);
            var item           = Utils.CurrentDataProvider.GetDocumentById(itemID);
            var data           = item.Content.Data;
            var documentFormat = GetDocumentFormat(data, item.Name);

            // View Mode emulation
            if (string.IsNullOrEmpty(Request.QueryString["edit"]))
            { // is view mode?
                using (MemoryStream ms = new MemoryStream())
                {
                    ms.Write(data, 0, data.Length);
                    ms.Position = 0;

                    string documentPreviewFilesFolder = Utils.GetDocumentPreviewFilesFolderById(itemID);
                    string documentPreviewFileName    = documentPreviewFilesFolder + @"\preview";
                    string html;
                    if (Directory.Exists(documentPreviewFilesFolder) && File.Exists(documentPreviewFileName))
                    {
                        html = File.ReadAllText(documentPreviewFileName);
                    }
                    else
                    {
                        ASPxHtmlEditor htmlEditor = new ASPxHtmlEditor();
                        htmlEditor.Import(GetHtmlEditorImportFormat(documentFormat), ms, true, documentPreviewFilesFolder);
                        html = htmlEditor.Html;
                        if (!Directory.Exists(documentPreviewFilesFolder))
                        {
                            Directory.CreateDirectory(documentPreviewFilesFolder);
                        }
                        File.WriteAllText(documentPreviewFileName, html);
                    }
                    viewer.InnerHtml = html;
                }

                viewerWrapper.Visible = true;
                richEdit.Visible      = false;
            }
            else
            {
                richEdit.Open(documentID + "&" + Guid.NewGuid().ToString(), () => data);
                viewerWrapper.Visible = false;
            }
        }
Пример #23
0
        protected void gridFrontMatter_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxHtmlEditor txtDescription = (ASPxHtmlEditor)gridFrontMatter.FindEditFormLayoutItemTemplateControl("txtDescription");
            FrontMatter    NewFrontMatter = new FrontMatter();

            NewFrontMatter.ProjectID   = Guid.Parse(Session["projectID"].ToString());
            NewFrontMatter.Name        = e.NewValues["Name"].ToString();
            NewFrontMatter.Description = txtDescription.Html;



            rtm_services.NewFrontMatter(NewFrontMatter);
            e.Cancel = true;
            var projectId = Session["projectID"].ToString();

            gridFrontMatter.DataSource = rtm_services.GetFrontMatter(projectId);
            gridFrontMatter.DataBind();
            gridFrontMatter.CancelEdit();
        }
    protected void he_CustomDataCallback(object sender, CustomDataCallbackEventArgs e)
    {
        ASPxHtmlEditor editor = sender as ASPxHtmlEditor;

        switch (e.Parameter)
        {
        case "Save":
            string rtf = string.Empty;
            using (MemoryStream ms = new MemoryStream()) {
                editor.Export(HtmlEditorExportFormat.Rtf, ms);
                ms.Flush();
                ms.Position = 0;
                using (StreamReader sr = new StreamReader(ms)) {
                    rtf = sr.ReadToEnd();
                }
            }
            SaveToDB(rtf);
            break;
        }
    }
Пример #25
0
 protected override WebControl CreateViewModeControlCore()
 {
     #region Submit Button
     submit = this.CreateSubmitButton();
     cancel = this.CreateCancelButton();
     pause  = this.CreatePauseButton();
     #endregion
     #region htmlEditor
     htmlEditor = CreateChatEditor();
     #endregion
     container = new ASPxCallbackPanel();
     container.ClientInstanceName           = "_ChatBox_Callback_Panel_";
     container.Callback                    += Container_Callback;
     container.ClientSideEvents.EndCallback = @"function(e){ eval('__ChatBox_Grid_').Refresh(); }";
     container.Controls.Add(htmlEditor);
     container.Controls.Add(this.CreateBottomPanel());
     container.Controls.Add(submit);
     container.Controls.Add(pause);
     container.Controls.Add(cancel);
     return(container);
 }
Пример #26
0
        protected void gridWorkflow_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            String         ItemKey      = Session["ItemKey"].ToString();
            ASPxGridView   gridWorkflow = (ASPxGridView)sender;
            ASPxComboBox   dropStatus   = (ASPxComboBox)gridWorkflow.FindEditFormLayoutItemTemplateControl("workflowDropStatus");
            ASPxComboBox   dropUser     = (ASPxComboBox)gridWorkflow.FindEditFormLayoutItemTemplateControl("workflowdropUser");
            ASPxHtmlEditor txComments   = (ASPxHtmlEditor)gridWorkflow.FindEditFormLayoutItemTemplateControl("txComments");

            Workflow NewStatus = new Workflow
            {
                ItemKey     = Guid.Parse(ItemKey),
                ProjectID   = Guid.Parse(Session["projectID"].ToString()),
                Status      = dropStatus.Text,
                StatusValue = Convert.ToInt32(dropStatus.Value.ToString()),
                Comments    = txComments.Html,
                WorkerID    = (dropUser.Value == null) ? Guid.Empty : Guid.Parse(dropUser.Value.ToString()),
                ManagerID   = Guid.Parse(rc_services.GetUserID()),
                DueDate     = Convert.ToDateTime(e.NewValues[0]),
                StatusDate  = DateTime.Now
            };

            var           item        = rc_services.GetItemName(ItemKey);
            string        worker      = dropUser.Text.ToString();
            Guid          WorkerID    = (dropUser.Value == null) ? Guid.Empty : Guid.Parse(dropUser.Value.ToString());
            string        manager     = HttpContext.Current.Session["UserEmail"].ToString();
            string        projectName = HttpContext.Current.Session["ProjectName"].ToString();
            string        Status      = dropStatus.Text;
            List <string> ListItems   = new List <string>();

            rc_services.WorkFlowNotificationEmail(WorkerID, worker, manager, projectName, Status, ListItems, item);

            rc_services.NewWorkflowStatus(NewStatus);
            e.Cancel = true;
            Guid projectID = Guid.Parse(Session["projectID"].ToString());

            gridWorkflow.DataSource = rc_services.GetWorkflow(Guid.Parse(ItemKey), projectID);
            gridWorkflow.DataBind();
            gridWorkflow.CancelEdit();
        }
Пример #27
0
        protected void gridResponse_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            String       MilestoneID  = Session["MilestoneID"].ToString();
            String       ItemID       = Session["CriteriaId"].ToString();
            ASPxGridView gridResponse = (ASPxGridView)sender;
            //ASPxComboBox AssessmentValue = (ASPxComboBox)gridResponse.FindEditFormLayoutItemTemplateControl("dropAssessment");
            ASPxHtmlEditor txResponse = (ASPxHtmlEditor)gridResponse.FindEditFormLayoutItemTemplateControl("txResponse");

            AssessmentResponse NewResponse = new AssessmentResponse
            {
                MilestoneID = Guid.Parse(Session["MilestoneID"].ToString()),
                ItemKey     = Guid.Parse(ItemID),
                Assesment   = e.NewValues["Assesment"].ToString(),
                Response    = txResponse.Html
            };

            rc_services.InsertNewResponse(NewResponse);
            e.Cancel = true;
            gridResponse.DataSource = rc_services.GetResponse(Guid.Parse(ItemID), MilestoneID);
            gridResponse.DataBind();
            gridResponse.CancelEdit();
        }
Пример #28
0
        static ModelHtmlEditorCustomDialogNodesGenerator()
        {
            _htmlEditor = new ASPxHtmlEditor();
            Type customDialogTemplateType     = typeof(HtmlEditorCustomDialogTemlate);
            var  customDialogTemplateTypeName = customDialogTemplateType.Name;
            var  customDialog = new HtmlEditorCustomDialog(ModelHtmlEditorToolBarNodesGenerator.InsertFileCommand,
                                                           "Insert File...",
                                                           "~/UserControls/" + customDialogTemplateTypeName + ".ascx");

            _htmlEditor.CustomDialogs.Add(customDialog);
            customDialog.OkButtonText = "Insert";
            if (Debugger.IsAttached)
            {
                var path     = UserContolPath(customDialogTemplateTypeName);
                var contents = customDialogTemplateType.GetResourceString(customDialogTemplateTypeName + ".ascx");
                File.WriteAllText(path, contents);

                const string resourceName = ModelHtmlEditorToolBarNodesGenerator.InsertFileCommand + ".png";
                var          filePath     = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"Images\" + resourceName);
                customDialogTemplateType.WriteResourceToFile(resourceName, filePath);
            }
        }
Пример #29
0
    protected string SaveJob()
    {
        try
        {
            ASPxPageControl            pageControl = this.grid_Issue.FindEditFormTemplateControl("pageControl_Hbl") as ASPxPageControl;
            ASPxTextBox                DoNo        = grid_Issue.FindEditFormTemplateControl("txt_DoNo") as ASPxTextBox;
            ASPxTextBox                txt_Id      = grid_Issue.FindEditFormTemplateControl("txt_Id") as ASPxTextBox;
            string                     pId         = SafeValue.SafeString(txt_Id.Text, "");
            Wilson.ORMapper.OPathQuery query       = new Wilson.ORMapper.OPathQuery(typeof(JobInfo), "Id='" + pId + "'");
            JobInfo                    job         = C2.Manager.ORManager.GetObject(query) as JobInfo;
            ASPxDateEdit               issueDate   = grid_Issue.FindEditFormTemplateControl("date_IssueDate") as ASPxDateEdit;
            bool isNew = false;
            //const string runType = "DOOUT";
            string issueN = "";
            if (job == null)
            {
                job         = new JobInfo();
                isNew       = true;
                job.JobType = "LMTemp";
                //issueN = C2Setup.GetNextNo("", "JobOrder", issueDate.Date);
                issueN      = "LMTemp-01";
                job.JobDate = issueDate.Date;
            }
            job.Attribute = "Temp";

            ASPxDateEdit doDate = grid_Issue.FindEditFormTemplateControl("date_IssueDate") as ASPxDateEdit;
            job.JobDate = doDate.Date;

            ASPxComboBox cmb_Status = grid_Issue.FindEditFormTemplateControl("cmb_Status") as ASPxComboBox;
            job.JobStage = SafeValue.SafeString(cmb_Status.Value);
            ASPxComboBox cmb_JobType = grid_Issue.FindEditFormTemplateControl("cmb_JobType") as ASPxComboBox;
            job.JobType = SafeValue.SafeString(cmb_JobType.Value);
            //Main Info

            ASPxMemo remark = grid_Issue.FindEditFormTemplateControl("txt_Remark") as ASPxMemo;
            job.Remark = remark.Text;
            ASPxButtonEdit currency = grid_Issue.FindEditFormTemplateControl("txt_Currency") as ASPxButtonEdit;
            job.Currency = currency.Text;
            ASPxSpinEdit exRate = grid_Issue.FindEditFormTemplateControl("spin_ExRate") as ASPxSpinEdit;
            job.ExRate = SafeValue.SafeDecimal(exRate.Value, 1);
            ASPxComboBox payTerm = grid_Issue.FindEditFormTemplateControl("cmb_PayTerm") as ASPxComboBox;
            job.PayTerm = payTerm.Text;
            ASPxDateEdit date_ExpiryDate = grid_Issue.FindEditFormTemplateControl("date_ExpiryDate") as ASPxDateEdit;
            job.ExpiryDate = date_ExpiryDate.Date;


            ASPxMemo txt_PackRemark = grid_Issue.FindEditFormTemplateControl("txt_PackRemark") as ASPxMemo;
            job.PackRmk = txt_PackRemark.Text;
            ASPxMemo txt_MoveRemark = grid_Issue.FindEditFormTemplateControl("txt_MoveRemark") as ASPxMemo;
            job.MoveRmk = txt_MoveRemark.Text;

            ASPxButtonEdit txt_WareHouseId = grid_Issue.FindEditFormTemplateControl("txt_WareHouseId") as ASPxButtonEdit;
            job.WareHouseId = txt_WareHouseId.Text;

            ASPxSpinEdit spin_Volumne = grid_Issue.FindEditFormTemplateControl("spin_Volumne") as ASPxSpinEdit;
            job.Volumne = SafeValue.SafeDecimal(spin_Volumne.Value);
            ASPxMemo memo_Description = grid_Issue.FindEditFormTemplateControl("memo_Description") as ASPxMemo;
            job.ItemDes = memo_Description.Text;
            ASPxTextBox memo_Volumn = grid_Issue.FindEditFormTemplateControl("memo_Volumn") as ASPxTextBox;
            job.VolumneRmk = memo_Description.Text;
            ASPxSpinEdit spin_HeadCount = grid_Issue.FindEditFormTemplateControl("spin_HeadCount") as ASPxSpinEdit;
            job.HeadCount = SafeValue.SafeInt(spin_HeadCount.Value, 0);

            ASPxDateEdit date_Pack = grid_Issue.FindEditFormTemplateControl("date_Pack") as ASPxDateEdit;
            job.PackDate = date_Pack.Date;
            ASPxComboBox cmb_Via = grid_Issue.FindEditFormTemplateControl("cmb_Via") as ASPxComboBox;
            job.ViaWh = cmb_Via.Text;
            ASPxDateEdit date_StorageStartDate = grid_Issue.FindEditFormTemplateControl("date_StorageStartDate") as ASPxDateEdit;
            job.StorageStartDate = date_StorageStartDate.Date;
            ASPxSpinEdit spin_StorageFreeDays = grid_Issue.FindEditFormTemplateControl("spin_StorageFreeDays") as ASPxSpinEdit;
            job.StorageFreeDays = SafeValue.SafeInt(spin_StorageFreeDays.Value, 0);
            ASPxSpinEdit spin_STotalDays = grid_Issue.FindEditFormTemplateControl("spin_STotalDays") as ASPxSpinEdit;
            job.StorageTotalDays = Helper.Safe.SafeInt(spin_STotalDays.Value);
            ASPxTextBox txt_TripNo = grid_Issue.FindEditFormTemplateControl("txt_TripNo") as ASPxTextBox;
            job.TripNo = txt_TripNo.Text;
            ASPxDateEdit date_MoveDate = grid_Issue.FindEditFormTemplateControl("date_MoveDate") as ASPxDateEdit;
            job.MoveDate = date_MoveDate.Date;
            ASPxSpinEdit spin_Charges = grid_Issue.FindEditFormTemplateControl("spin_Charges") as ASPxSpinEdit;
            job.Charges = SafeValue.SafeDecimal(spin_Charges.Value);
            ASPxButtonEdit btn_PortOfEntry = grid_Issue.FindEditFormTemplateControl("btn_PortOfEntry") as ASPxButtonEdit;
            job.EntryPort = btn_PortOfEntry.Text;
            ASPxComboBox txt_Mode = grid_Issue.FindEditFormTemplateControl("cmb_Mode") as ASPxComboBox;
            job.Mode = txt_Mode.Text;
            ASPxDateEdit date_Eta = grid_Issue.FindEditFormTemplateControl("date_Eta") as ASPxDateEdit;
            job.Eta = date_Eta.Date;
            ASPxTextBox txt_TruckNo = grid_Issue.FindEditFormTemplateControl("txt_TruckNo") as ASPxTextBox;
            job.TruckNo = txt_TruckNo.Text;

            ASPxComboBox cmb_ServiceType = grid_Issue.FindEditFormTemplateControl("cmb_ServiceType") as ASPxComboBox;
            job.ServiceType = cmb_ServiceType.Text;
            //Additional

            ASPxComboBox cmb_FullPacking = pageControl.FindControl("cmb_FullPacking") as ASPxComboBox;
            job.Item1 = SafeValue.SafeString(cmb_FullPacking.Value);
            ASPxComboBox cmb_UnFull = pageControl.FindControl("cmb_UnFull") as ASPxComboBox;
            job.Item2 = SafeValue.SafeString(cmb_UnFull.Value);
            ASPxTextBox txt_Details = pageControl.FindControl("txt_Details") as ASPxTextBox;
            job.ItemDetail1 = txt_Details.Text;
            ASPxTextBox txt_UnpackDetails = pageControl.FindControl("txt_UnpackDetails") as ASPxTextBox;
            job.ItemDetail2 = txt_UnpackDetails.Text;

            ASPxComboBox cmb_Insurance = pageControl.FindControl("cmb_Insurance") as ASPxComboBox;
            job.Item3 = SafeValue.SafeString(cmb_Insurance.Value);
            ASPxTextBox txt_Percentage = pageControl.FindControl("txt_Percentage") as ASPxTextBox;
            job.ItemValue3 = txt_Percentage.Text;
            ASPxTextBox txt_Value = pageControl.FindControl("txt_Value") as ASPxTextBox;
            job.ItemData3 = txt_Value.Text;
            ASPxSpinEdit txt_Premium = pageControl.FindControl("txt_Premium") as ASPxSpinEdit;
            job.ItemPrice3 = SafeValue.SafeDecimal(txt_Premium.Text);

            ASPxComboBox cmb_PianoApply = pageControl.FindControl("cmb_PianoApply") as ASPxComboBox;
            job.Item4 = SafeValue.SafeString(cmb_PianoApply.Value);
            ASPxTextBox txt_PainoDetails = pageControl.FindControl("txt_PainoDetails") as ASPxTextBox;
            job.ItemDetail4 = txt_PainoDetails.Text;
            ASPxSpinEdit spin_Charges1 = pageControl.FindControl("spin_Charges1") as ASPxSpinEdit;
            job.ItemPrice4 = SafeValue.SafeDecimal(spin_Charges1.Value);

            ASPxComboBox cmb_Safe = pageControl.FindControl("cmb_Safe") as ASPxComboBox;
            job.Item5 = cmb_Safe.Text;
            ASPxTextBox txt_Brand = pageControl.FindControl("txt_Brand") as ASPxTextBox;
            job.ItemValue5 = SafeValue.SafeString(txt_Brand.Value);
            ASPxSpinEdit spin_Weight = pageControl.FindControl("spin_Weight") as ASPxSpinEdit;
            job.ItemPrice5 = SafeValue.SafeDecimal(spin_Weight.Value);

            ASPxComboBox cmb_Crating = pageControl.FindControl("cmb_Crating") as ASPxComboBox;
            job.Item6 = SafeValue.SafeString(cmb_Crating.Value);
            ASPxTextBox txt_Details1 = pageControl.FindControl("txt_Details1") as ASPxTextBox;
            job.ItemDetail6 = txt_Details1.Text;
            ASPxSpinEdit spin_Charges2 = pageControl.FindControl("spin_Charges2") as ASPxSpinEdit;
            job.ItemPrice6 = SafeValue.SafeDecimal(spin_Charges2.Value);

            ASPxComboBox cmb_Handyman = pageControl.FindControl("cmb_Handyman") as ASPxComboBox;
            job.Item7 = SafeValue.SafeString(cmb_Handyman.Value);
            ASPxComboBox cmb_Complimentory = pageControl.FindControl("cmb_Complimentory") as ASPxComboBox;
            job.ItemValue7 = SafeValue.SafeString(cmb_Complimentory.Value);
            ASPxTextBox txt_Details2 = pageControl.FindControl("txt_Details2") as ASPxTextBox;
            job.ItemDetail7 = txt_Details2.Text;
            ASPxSpinEdit spin_Charges3 = pageControl.FindControl("spin_Charges3") as ASPxSpinEdit;
            job.ItemPrice7 = SafeValue.SafeDecimal(spin_Charges3.Value);

            ASPxComboBox cmb_Maid = pageControl.FindControl("cmb_Maid") as ASPxComboBox;
            job.Item8 = SafeValue.SafeString(cmb_Maid.Value);
            ASPxComboBox cmb_Complimentory1 = pageControl.FindControl("cmb_Complimentory1") as ASPxComboBox;
            job.ItemValue8 = SafeValue.SafeString(cmb_Complimentory1.Value);
            ASPxTextBox txt_Details3 = pageControl.FindControl("txt_Details3") as ASPxTextBox;
            job.ItemDetail8 = txt_Details3.Text;
            ASPxSpinEdit spin_Charges4 = pageControl.FindControl("spin_Charges4") as ASPxSpinEdit;
            job.ItemPrice8 = SafeValue.SafeDecimal(spin_Charges4.Value);

            ASPxComboBox cmb_Shifting = pageControl.FindControl("cmb_Shifting") as ASPxComboBox;
            job.Item9 = SafeValue.SafeString(cmb_Shifting.Value);
            ASPxComboBox cmb_Complimentory2 = pageControl.FindControl("cmb_Complimentory2") as ASPxComboBox;
            job.ItemValue9 = SafeValue.SafeString(cmb_Complimentory2.Value);
            ASPxTextBox txt_Details4 = pageControl.FindControl("txt_Details4") as ASPxTextBox;
            job.ItemDetail9 = txt_Details4.Text;
            ASPxSpinEdit spin_Charges5 = pageControl.FindControl("spin_Charges5") as ASPxSpinEdit;
            job.ItemPrice9 = SafeValue.SafeDecimal(spin_Charges5.Value);

            ASPxComboBox cmb_Disposal = pageControl.FindControl("cmb_Disposal") as ASPxComboBox;
            job.Item10 = cmb_Disposal.Text;
            ASPxComboBox cmb_Complimentory3 = pageControl.FindControl("cmb_Complimentory3") as ASPxComboBox;
            job.ItemValue10 = cmb_Complimentory3.Text;
            ASPxTextBox txt_Details5 = pageControl.FindControl("txt_Details5") as ASPxTextBox;
            job.ItemDetail10 = txt_Details5.Text;
            ASPxSpinEdit spin_Charges6 = pageControl.FindControl("spin_Charges6") as ASPxSpinEdit;
            job.ItemPrice10 = SafeValue.SafeDecimal(spin_Charges6.Value);

            ASPxComboBox cmb_PickUp = pageControl.FindControl("cmb_PickUp") as ASPxComboBox;
            job.Item11 = SafeValue.SafeString(cmb_PickUp.Value);
            ASPxTextBox txt_Details6 = pageControl.FindControl("txt_Details6") as ASPxTextBox;
            job.ItemDetail11 = txt_Details6.Text;

            ASPxComboBox cmb_Additional = pageControl.FindControl("cmb_Additional") as ASPxComboBox;
            job.Item12 = cmb_Additional.Text;
            ASPxTextBox txt_Details7 = pageControl.FindControl("txt_Details7") as ASPxTextBox;
            job.ItemDetail12 = txt_Details7.Text;

            ASPxComboBox cmb_BadAccess = pageControl.FindControl("cmb_BadAccess") as ASPxComboBox;
            job.Item13 = SafeValue.SafeString(cmb_BadAccess.Value);
            ASPxComboBox cmb_Origin = pageControl.FindControl("cmb_Origin") as ASPxComboBox;
            job.ItemValue13 = cmb_Origin.Text;
            ASPxComboBox cmb_Destination = pageControl.FindControl("cmb_Destination") as ASPxComboBox;
            job.ItemData13 = SafeValue.SafeString(cmb_Destination.Value);

            ASPxComboBox cmb_Storage = pageControl.FindControl("cmb_Storage") as ASPxComboBox;
            job.Item14 = SafeValue.SafeString(cmb_Storage.Value);
            ASPxComboBox cmb_Complimentory4 = pageControl.FindControl("cmb_Complimentory4") as ASPxComboBox;
            job.ItemValue14 = SafeValue.SafeString(cmb_Complimentory4.Value);
            ASPxTextBox txt_Details8 = pageControl.FindControl("txt_Details8") as ASPxTextBox;
            job.ItemDetail14 = txt_Details8.Text;
            ASPxSpinEdit spin_Charges7 = pageControl.FindControl("spin_Charges7") as ASPxSpinEdit;
            job.ItemPrice14 = SafeValue.SafeDecimal(spin_Charges7.Value);

            ASPxTextBox txt_How = pageControl.FindControl("txt_How") as ASPxTextBox;
            job.Answer1 = txt_How.Text;
            ASPxTextBox txt_Other = pageControl.FindControl("txt_Other") as ASPxTextBox;
            job.Answer2 = txt_Other.Text;
            ASPxTextBox txt_Move = pageControl.FindControl("txt_Move") as ASPxTextBox;
            job.Answer3 = txt_Move.Text;
            ASPxTextBox txt_UnsuccessRemark = pageControl.FindControl("txt_UnsuccessRemark") as ASPxTextBox;
            job.Answer4 = txt_UnsuccessRemark.Text;
            ASPxComboBox cmb_WorkStatus = grid_Issue.FindEditFormTemplateControl("cmb_WorkStatus") as ASPxComboBox;
            job.WorkStatus = SafeValue.SafeString(cmb_WorkStatus.Value);



            //Quotation
            ASPxHtmlEditor txt_Attention1 = pageControl.FindControl("txt_Attention1") as ASPxHtmlEditor;
            if (txt_Attention1 != null)
            {
                job.Attention1 = txt_Attention1.Html;
            }
            ASPxHtmlEditor txt_Attention2 = pageControl.FindControl("txt_Attention2") as ASPxHtmlEditor;
            if (txt_Attention2 != null)
            {
                job.Attention2 = txt_Attention2.Html;
            }
            ASPxHtmlEditor txt_Attention3 = pageControl.FindControl("txt_Attention3") as ASPxHtmlEditor;
            if (txt_Attention3 != null)
            {
                job.Attention3 = txt_Attention3.Html;
            }
            ASPxHtmlEditor txt_Attention4 = pageControl.FindControl("txt_Attention4") as ASPxHtmlEditor;
            if (txt_Attention4 != null)
            {
                job.Attention4 = txt_Attention4.Html;
            }

            if (cmb_Status.Text == "Job Confirmation")
            {
                job.WorkStatus = "Pending";
            }
            ASPxComboBox cmb_SalesId = grid_Issue.FindEditFormTemplateControl("cmb_SalesId") as ASPxComboBox;
            job.Value4 = cmb_SalesId.Text;


            if (cmb_Status.Text == "Job Confirmation")
            {
                job.WorkStatus = "Pending";
            }
            if (job.JobStage == "Customer Inquiry")
            {
                job.DateTime1 = DateTime.Now;
            }


            if (job.WorkStatus == "Costing")
            {
                job.DateTime3 = DateTime.Now;
            }
            if (job.WorkStatus == "Quotation")
            {
                job.DateTime4 = DateTime.Now;
            }
            if (job.WorkStatus == "Job Confirmation")
            {
                job.DateTime5 = DateTime.Now;
            }
            if (job.WorkStatus == "Billing")
            {
                job.DateTime6 = DateTime.Now;
            }
            if (job.WorkStatus == "Job Completion")
            {
                job.DateTime7 = DateTime.Now;
            }
            if (job.WorkStatus == "Job Close")
            {
                job.DateTime8 = DateTime.Now;
            }

            ASPxMemo memo_Notes = pageControl.FindControl("memo_Notes") as ASPxMemo;
            job.Notes = memo_Notes.Text;
            string userId = HttpContext.Current.User.Identity.Name;
            if (isNew)
            {
                job.CreateBy       = userId;
                job.CreateDateTime = DateTime.Now;
                job.UpdateBy       = userId;
                job.UpdateDateTime = DateTime.Now;
                job.JobNo          = issueN;
                Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(job);
                // C2Setup.SetNextNo("", "JobOrder", issueN, issueDate.Date);
            }
            else
            {
                job.UpdateBy       = userId;
                job.UpdateDateTime = DateTime.Now;
                bool isAddLog = false;
                if (job.JobStatus == SafeValue.SafeString(ConnectSql.ExecuteScalar("Select JobStatus from JobInfo where JobNo='" + job.JobNo + "'")))
                {
                }
                else
                {
                    isAddLog = true;
                }
                Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(job);
                if (isAddLog)
                {
                    EzshipLog.Log(job.JobNo, "", "JO", job.JobStatus);
                }
            }
            Session["SoWhere"]            = "JobNo='" + job.JobNo + "'";
            this.dsIssue.FilterExpression = Session["SoWhere"].ToString();
            if (this.grid_Issue.GetRow(0) != null)
            {
                this.grid_Issue.StartEdit(0);
            }

            return(job.JobNo);
        }
        catch (Exception ex) { throw new Exception(ex.Message + ex.StackTrace); }
        return("");
    }
Пример #30
0
 protected void HtmlEditor_Init(object sender, EventArgs e)
 {
     ASPxHtmlEditor htmlEditor = sender as ASPxHtmlEditor;
     //htmlEditor.DesignMode = false;
     //htmlEditor.SetDefaultBooleanProperty("", DevExpress.Web.ASPxClasses.DefaultBoolean.
 }