示例#1
0
        public void BindFrmSorts()
        {
            FrmSorts fss = new FrmSorts();

            fss.RetrieveAll();
            this.Pub1.AddH2("表单类别维护");
            this.Pub1.AddHR();

            this.Pub1.AddTable("align=left");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("序号");
            this.Pub1.AddTDTitle("类别编号");
            this.Pub1.AddTDTitle("类别名称");
            this.Pub1.AddTREnd();

            for (int i = 1; i <= 15; i++)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(i);


                TextBox tb = new TextBox();
                tb.Text = i.ToString().PadLeft(2, '0');
                FrmSort fs = fss.GetEntityByKey(FrmSortAttr.No, tb.Text) as FrmSort;

                tb.ID       = "TB_No_" + i;
                tb.Columns  = 5;
                tb.ReadOnly = true;
                this.Pub1.AddTD(tb.Text);

                tb         = new TextBox();
                tb.ID      = "TB_Name_" + i;
                tb.Columns = 40;
                if (fs != null)
                {
                    tb.Text = fs.Name;
                }

                this.Pub1.AddTD(tb);
                this.Pub1.AddTREnd();
            }

            Button btn = new Button();

            btn.Text     = "Save";
            btn.CssClass = "Btn";
            btn.Click   += new EventHandler(btn_SaveFrmSort_Click);
            this.Pub1.Add(btn);

            this.Pub1.AddTR();
            this.Pub1.AddTD("colspan=2", btn);

            this.Pub1.AddTD("要删除类别,请把文本框数据清空保存即可。");

            this.Pub1.AddTREnd();

            this.Pub1.AddTableEndWithHR();
        }
示例#2
0
        public string DoType(string doType, string v1, string v2, string v3, string v4, string v5)
        {
            try
            {
                switch (doType)
                {
                case "AdminLogin":
                    try
                    {
                        Emp emp = new Emp();
                        emp.No = v1;
                        emp.RetrieveFromDBSources();
                        if (emp.Pass == v2)
                        {
                            return(null);
                        }
                        return("error password.");
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message);
                    }

                case "DeleteFrmSort":
                    FrmSort fs = new FrmSort();
                    fs.No = v1;
                    fs.Delete();
                    return(null);

                case "DeleteFrm":
                case "DelFrm":
                    MapData md = new MapData();
                    md.No = v1;
                    md.Delete();
                    return(null);

                case "InitDesignerXml":
                    string  path = BP.SystemConfig.PathOfData + "\\Xml\\Designer.xml";
                    DataSet ds   = new DataSet();
                    ds.ReadXml(path);
                    ds = this.TurnXmlDataSet2SLDataSet(ds);
                    return(Connector.ToXml(ds));

                default:
                    throw new Exception("没有判断的,功能编号" + doType);
                }
            }
            catch (Exception ex)
            {
                BP.DA.Log.DefaultLogWriteLineError("执行错误,功能编号" + doType + " error:" + ex.Message);
                throw new Exception("执行错误,功能编号" + doType + " error:" + ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            string path = "C:\\CCFlowTemplete" + DateTime.Now.ToString("yy年MM月dd日HH时mm分ss秒");

            if (System.IO.Directory.Exists(path) == false)
            {
                System.IO.Directory.CreateDirectory(path);
            }

            Flows fls = new Flows();

            fls.RetrieveAllFromDBSource();
            foreach (Flow fl in fls)
            {
                FlowSort fs      = new FlowSort(fl.FK_FlowSort);
                string   pathDir = path + "\\Flow\\" + fs.No + "." + fs.Name;
                if (System.IO.Directory.Exists(pathDir) == false)
                {
                    System.IO.Directory.CreateDirectory(pathDir);
                }

                //  fl.GenerFlowXmlTemplete(pathDir + "\\" + fl.Name + ".xml");
                fl.GenerFlowXmlTemplete(pathDir);
            }

            MapDatas mds = new MapDatas();

            mds.RetrieveAllFromDBSource();
            foreach (MapData md in mds)
            {
                if (md.FK_FrmSort.Length < 2)
                {
                    continue;
                }

                FrmSort fs      = new FrmSort(md.FK_FrmSort);
                string  pathDir = path + "\\Form\\" + fs.No + "." + fs.Name;
                if (System.IO.Directory.Exists(pathDir) == false)
                {
                    System.IO.Directory.CreateDirectory(pathDir);
                }
                DataSet ds = md.GenerHisDataSet();
                ds.WriteXml(pathDir + "\\" + md.Name + ".xml");
            }
            return("执行成功,存放路径:" + path);
        }
示例#4
0
 void btn_SaveFrmSort_Click(object sender, EventArgs e)
 {
     for (int i = 1; i <= 15; i++)
     {
         TextBox tbName = this.Pub1.GetTextBoxByID("TB_Name_" + i);
         FrmSort fs     = new FrmSort();
         fs.No   = i.ToString().PadLeft(2, '0');
         fs.Name = tbName.Text.ToString();
         if (fs.Name.Length > 1)
         {
             fs.Save();
         }
         else
         {
             fs.Delete();
         }
     }
     this.Alert("保存成功");
 }
示例#5
0
        public string Do(string doWhat, string para1, bool isLogin)
        {
            // 如果admin账户登陆时有错误发生,则返回错误信息
            var result = LetAdminLogin("CH", isLogin);

            if (string.IsNullOrEmpty(result) == false)
            {
                return(result);
            }

            switch (doWhat)
            {
            case "GenerFlowTemplete":
                Flow temp = new BP.WF.Flow(para1);
                return(null);

            case "NewFrmSort":
                BP.Sys.FrmSort frmSort = null;
                try
                {
                    frmSort      = new FrmSort();
                    frmSort.No   = "01";
                    frmSort.Name = para1;
                    frmSort.No   = frmSort.GenerNewNo;
                    frmSort.Insert();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewFlowSort":
                BP.WF.FlowSort fs = null;
                try
                {
                    fs      = new FlowSort();
                    fs.Name = para1;
                    fs.No   = fs.GenerNewNo;
                    fs.Insert();
                    return(fs.No);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(null);
                }

            case "EditFlowSort":
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0]);
                    fs.Name = para[1];
                    fs.Save();
                    return(fs.No);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(null);
                }

            case "NewFlow":
                Flow fl = new Flow();
                try
                {
                    string[] ps = para1.Split(',');
                    if (ps.Length != 5)
                    {
                        throw new Exception("@创建流程参数错误");
                    }

                    string         fk_floSort    = ps[0];
                    string         flowName      = ps[1];
                    DataStoreModel dataSaveModel = (DataStoreModel)int.Parse(ps[2]);
                    string         pTable        = ps[3];
                    string         flowCode      = ps[4];

                    fl.DoNewFlow(fk_floSort, flowName, dataSaveModel, pTable, flowCode);
                    return(fl.No + ";" + fl.Name);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(ex.Message);
                }

            case "DelFlow":
                BP.WF.Flow fl1 = new BP.WF.Flow(para1);
                try
                {
                    fl1.DoDelete();
                    return(null);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(ex.Message);
                }

            case "DelLable":
                BP.WF.LabNote ln = new BP.WF.LabNote(para1);
                try
                {
                    ln.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelLable Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(null);

            case "DelFlowSort":
                try
                {
                    FlowSort delfs = new FlowSort(para1);
                    delfs.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "NewNode":
                try
                {
                    BP.WF.Flow fl11 = new BP.WF.Flow(para1);
                    BP.WF.Node node = new BP.WF.Node();
                    node.FK_Flow = "";
                    node.X       = 0;
                    node.Y       = 0;
                    node.Insert();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewNode Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelNode Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(null);

            case "NewLab":
                BP.WF.LabNote lab = new BP.WF.LabNote();;
                try
                {
                    lab.FK_Flow = para1;
                    lab.MyPK    = BP.DA.DBAccess.GenerOID().ToString();
                    lab.Insert();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewLab Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(lab.MyPK);

            case "DelLab":
                try
                {
                    BP.WF.LabNote dellab = new BP.WF.LabNote();
                    dellab.MyPK = para1;
                    dellab.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelLab Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "GetSettings":
                return(SystemConfig.AppSettings[para1]);

            case "GetFlows":
                string sqls = "SELECT NO,NAME FROM WF_FlowSort";
                sqls += "@SELECT No,Name,FK_FlowSort FROM WF_Flow";
                return(RunSQLReturnTableS(sqls));

            case "SaveFlowFrm":
                Entity en = null;
                try
                {
                    AtPara ap     = new AtPara(para1);
                    string enName = ap.GetValStrByKey("EnName");
                    string pk     = ap.GetValStrByKey("PKVal");
                    en = ClassFactory.GetEn(enName);
                    en.ResetDefaultVal();

                    if (en == null)
                    {
                        throw new Exception("无效的类名:" + enName);
                    }

                    if (string.IsNullOrEmpty(pk) == false)
                    {
                        en.PKVal = pk;
                        en.RetrieveFromDBSources();
                    }

                    foreach (string key in ap.HisHT.Keys)
                    {
                        if (key == "PKVal")
                        {
                            continue;
                        }
                        en.SetValByKey(key, ap.HisHT[key].ToString().Replace('^', '@'));
                    }
                    en.Save();
                    return(en.PKVal as string);
                }
                catch (Exception ex)
                {
                    if (en != null)
                    {
                        en.CheckPhysicsTable();
                    }
                    return("Error:" + ex.Message);
                }

            case "ReleaseToFTP":
                // 暂时注释,下次更新ftp功能时会得新编译 。
                //var args = para1.Split(',');
                //var binaryData = Convert.FromBase64String(args[1]);
                //var imageFilePath = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath) + "/Temp/" + args[0] + ".jpg";
                //if (File.Exists(imageFilePath))
                //{
                //    File.Delete(imageFilePath);
                //}
                //System.IO.Directory.CreateDirectory(
                //    Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath) + "/Temp");
                //var stream = new System.IO.FileStream(imageFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                //stream.Write(binaryData, 0, binaryData.Length);
                //stream.Close();
                //var xmlFilePath = FlowTemplete_Gener(args[0], true);
                //string remoteDr = "/" + ConfigurationSettings.AppSettings["UserIdentifier"];;
                //var ftp = new FtpConnection();
                //try
                //{
                //    string ftpIP = ConfigurationSettings.AppSettings["FTPServerIP"];
                //    string email = ConfigurationSettings.AppSettings["FTPUserEmail"];

                //    Session session = new Session();
                //    session.Server = ftpIP;


                //    session.Connect("anonymous", "*****@*****.**");
                //    ftp.Connect(ftpIP, "anonymous", email);
                //    remoteDr = remoteDr;
                //    if(!ftp.DirectoryExist(remoteDr))
                //    {
                //        ftp.CreateDirectory(remoteDr);
                //    }
                //    ftp.SetCurrentDirectory(remoteDr);
                //    ftp.PutFile(imageFilePath, remoteDr);
                //    return string.Empty;//上传成功

                //}
                //catch (Exception err)
                //{
                //    return err.Message;//上传失败
                //}
                //finally
                //{
                //    ftp.Close();
                //}
                return(string.Empty);

            default:
                throw null;
            }
        }
示例#6
0
        public void Share()
        {
            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeftTX("在施工中..");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("项目");
            this.Pub1.AddTDTitle("采集");
            this.Pub1.AddTDTitle("说明");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("表单类别");
            MapData md = new MapData(this.RefNo);
            TextBox tb = new TextBox();

            tb.ID = "TB_Sort";
            if (string.IsNullOrEmpty(md.FK_FrmSort.Trim()))
            {
                /*没有类别,就考虑是节点表单*/
            }
            else
            {
                FrmSort fs = new FrmSort();
                fs.No = md.No;
                fs.RetrieveFromDBSources();
                tb.Text = md.No;
            }
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("表单名称");
            tb      = new TextBox();
            tb.ID   = "TB_Name";
            tb.Text = md.Name;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();

            //this.Pub1.AddTR();
            //this.Pub1.AddTD("设计者");
            //tb = new TextBox();
            //tb.ID = "TB_Designer";
            //tb.Text = md.Designer;
            //this.Pub1.AddTD(tb);

            //this.Pub1.AddTD();
            //this.Pub1.AddTREnd();

            //this.Pub1.AddTR();
            //this.Pub1.AddTD("设计单位");
            //tb = new TextBox();
            //tb.ID = "TB_DesignerContact";
            //tb.Text = md.DesignerContact;
            //this.Pub1.AddTD(tb);
            //this.Pub1.AddTD();
            //this.Pub1.AddTREnd();

            //this.Pub1.AddTR();
            //this.Pub1.AddTD("联系方式");
            //tb = new TextBox();
            //tb.ID = "TB_DesignerContact";
            //tb.Text = md.DesignerContact;
            //tb.Columns = 50;
            //this.Pub1.AddTD(tb);
            //this.Pub1.AddTD();
            //this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD();
            Button btn = new Button();

            btn.CssClass = "Btn";
            btn.ID       = "Btn_Save";
            btn.Text     = "Share It";
            btn.Click   += new EventHandler(btn_ShareIt_Click);
            this.Pub1.AddTD(btn);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();

            this.Pub1.AddFieldSet("共享说明");
            this.Pub1.Add("如果您想批量的共享表单,请转到流程设计器-功能执行-导出流程与表单模板,发送邮件到[email protected]中。");
            this.Pub1.AddFieldSetEnd();
        }
示例#7
0
        public override object Do()
        {
            string    msg   = "";
            FlowSorts sorts = new FlowSorts();

            sorts.ClearTable();

            DirectoryInfo dirInfo = new DirectoryInfo(SystemConfig.PathOfData + "\\FlowDemo\\Flow\\");

            DirectoryInfo[] dirs = dirInfo.GetDirectories();
            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No   = dir.Name.Substring(0, 2);
                fs.Name = dir.Name.Substring(3);
                fs.Insert();
                foreach (string filePath in fls)
                {
                    msg += "@开始调度流程模板文件:" + filePath;
                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "@流程:" + myflow.Name + "装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }
                    myflow.DirectUpdate();
                }
            }

            // 调度表单文件。
            FrmSorts fss = new FrmSorts();

            fss.ClearTable();

            string frmPath = SystemConfig.PathOfData + "\\FlowDemo\\Form\\";

            dirInfo = new DirectoryInfo(frmPath);
            dirs    = dirInfo.GetDirectories();
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }
                FrmSort fs = new FrmSort();
                fs.No   = item.Name.Substring(0, 2);
                fs.Name = item.Name.Substring(3);
                fs.Insert();

                foreach (string f in fls)
                {
                    try
                    {
                        msg += "@开始调度表单模板文件:" + f;
                        System.IO.FileInfo info = new System.IO.FileInfo(f);
                        if (info.Extension != ".xml")
                        {
                            continue;
                        }

                        DataSet ds = new DataSet();
                        ds.ReadXml(f);

                        MapData md = MapData.ImpMapData(ds, false);
                        md.FK_FrmSort = fs.No;
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        msg += "@调度失败" + ex.Message;
                    }
                }
            }

            BP.DA.Log.DefaultLogWriteLineInfo(msg);
            return(msg);
        }