protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string foldername = Request.Form["foldername"];
                    string selectid   = Request.Form["selectid"];
                    string message    = Request.Form["message"];

                    if (selectid.Contains("root"))
                    {
                        selectid = selectid.Remove(0, "root".Length);

                        eChartProject.Model.eChart.server_contents_folders model = new eChartProject.Model.eChart.server_contents_folders();

                        model.Foldername = foldername.Trim();
                        model.ParentID   = int.Parse(selectid);
                        model.isDeleted  = 1;
                        model.isOffline  = 0;

                        Fbll.Add(model);

                        Response.Write("success");
                        Response.End();
                    }
                    else if (selectid.Contains("folder"))
                    {
                        selectid = selectid.Remove(0, "folder".Length);
                        //insert message
                        eChartProject.Model.eChart.server_contents_message model = new eChartProject.Model.eChart.server_contents_message();

                        model.Question     = message.Trim();
                        model.FolderID     = int.Parse(selectid);
                        model.isOffLine    = 0;
                        model.isPublic     = 1;
                        model.isVariations = 0;
                        model.RelatedID    = 0;
                        model.sortOrder    = SortOrderHelper.GetSortOrder(model.FolderID);
                        model.isDeleted    = 1;

                        bll.Add(model);

                        //insert answer
                        eChartProject.Model.eChart.server_contents_answers ansmodel = new eChartProject.Model.eChart.server_contents_answers();
                        ansmodel.Answer    = "";
                        ansmodel.MessageID = bll.GetMaxId() - 1;
                        ansmodel.isDeleted = 0;
                        abll.Add(ansmodel);

                        Response.Write("success");
                        Response.End();
                    }
                }
                catch
                {
                }
            }
        }
            public void PasteFromCut()
            {
                if (toID.Contains(Nodetype.folder.ToString()))
                {
                    int iFolderID = int.Parse(toID.Remove(0, Nodetype.folder.ToString().Length));
                    int iToRootID = int.Parse(ID.Remove(0, Nodetype.root.ToString().Length));
                    eChartProject.Model.eChart.server_contents_folders model = new eChartProject.Model.eChart.server_contents_folders();
                    model          = Fbll.GetModel(iFolderID);
                    model.ParentID = iToRootID;

                    Fbll.Add(model);
                    Fbll.Delete(iFolderID);
                }
            }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string folderMsgname = Request.Form["human"];
                    string selectid      = Request.Form["selectid"];
                    string answer        = Request.Form["answer"];
                    string isPrivate     = Request.Form["isPrivate"];

                    if (selectid.Contains(Nodetype.folder.ToString()))
                    {
                        selectid = selectid.Remove(0, Nodetype.folder.ToString().Length);

                        eChartProject.Model.eChart.server_contents_folders model = new eChartProject.Model.eChart.server_contents_folders();
                        model.Foldername = folderMsgname.Trim();
                        model.FolderID   = int.Parse(selectid);
                        Fbll.UpdateByFolderName(model);

                        Response.Write("success");
                        Response.End();
                    }
                    else if (selectid.Contains(Nodetype.message.ToString()))
                    {
                        selectid = selectid.Remove(0, Nodetype.message.ToString().Length);
                        //update message
                        eChartProject.Model.eChart.server_contents_message model = new eChartProject.Model.eChart.server_contents_message();
                        model.Question = folderMsgname.Trim();
                        model.ID       = int.Parse(selectid);
                        if (!string.IsNullOrEmpty(isPrivate) & isPrivate == "true")
                        {
                            model.isPublic = 0;
                            bll.UpdateByIsPublic(model);
                        }
                        else if (!string.IsNullOrEmpty(isPrivate) & isPrivate == "false")
                        {
                            model.isPublic = 1;
                            bll.UpdateByIsPublic(model);
                        }
                        bll.UpdateByQuestion(model);

                        //update answer
                        eChartProject.Model.eChart.server_contents_answers modelans = new eChartProject.Model.eChart.server_contents_answers();
                        DataSet ds = abll.GetList(" messageID=" + int.Parse(selectid));

                        if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            string ID = ds.Tables[0].Rows[0]["ID"].ToString();
                            modelans.ID        = int.Parse(ID);
                            modelans.Answer    = answer.Trim();
                            modelans.MessageID = int.Parse(selectid);
                            modelans.isDeleted = 0;

                            if (abll.Update(modelans))
                            {
                                //send answer to ROBORT INTERFACE
                                DataTable dt = new DataTable();
                                dt.Columns.Add("uri");
                                dt.Columns.Add("question");
                                dt.Columns.Add("answer");

                                string qus = "\"" + model.Question + GetQuestionAndVariations(modelans.MessageID) + "\"";

                                dt.Rows.Add(modelans.MessageID, qus, "\"" + Utils.ConvertInvaidCharacter(HttpUtility.HtmlDecode(Utils.StrFormatD(Utils.RemoveHtml(answer.Trim())))) + "\"");
                                Robot.SAVETOROBOT(dt);
                            }
                            Response.Write("success");
                            Response.End();
                        }
                    }
                }
                catch
                {
                }
            }
        }