Example #1
0
        /// <summary>
        /// 删除订单
        /// </summary>
        /// <param name="id">订单的id值</param>
        private void Del(int id)
        {
            To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(id);

            if (orderinfo != null)
            {
                int     jobflowid = orderinfo.JobflowID;
                JobFlow model     = JobFlowManager.GetModel(jobflowid);

                if (model == null || model.auditstatus != "01")
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('订单已删除或审核员已审核')</script>");
                }
                else if (!To_OrderInfoManager.CanDelete(id))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('该订单关联过收款或付款或退款或报销,无法删除')</script>");
                }
                else
                {
                    string strdel = " jobflowid=" + jobflowid;
                    AuditJobFlowManager.Delete(strdel);
                    JobFlowManager.Delete(jobflowid);
                    To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(id));
                    To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(id));
                    To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(id));
                    To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(id));
                }
            }
        }
Example #2
0
        /// <summary>
        /// 添加工作流管理
        /// </summary>
        /// <param name="args">保存或已提交</param>
        private int SavePaymentWorkflow(string args, string auditsatus, string serialNumber)
        {
            int     result  = 0;
            JobFlow jobflow = null;

            if (Request.Params["jobflowid"] == null || Request.Params["jobflowid"] == "")
            {
                jobflow             = new JobFlow();
                jobflow.savestatus  = args.ToString();
                jobflow.createtime  = DateTime.Now;
                jobflow.endtime     = DateTime.Now;
                jobflow.cname       = serialNumber;
                jobflow.attachment  = "";
                jobflow.sort        = "05";
                jobflow.auditsort   = "";
                jobflow.auditstatus = auditsatus;
                jobflow.founderid   = ((LoginInfo)Session["login"]).Id;
                jobflow.txt         = "";
                jobflow.ruleid      = int.Parse(ddlApproval.SelectedValue);
                result = JobFlowManager.AddAndGetId(jobflow);
            }
            else
            {
                result  = int.Parse(Request.Params["jobflowid"]);
                jobflow = JobFlowManager.GetModel(int.Parse(Request.Params["jobflowid"]));
                if (jobflow != null)
                {
                    jobflow.savestatus  = args.ToString();
                    jobflow.auditstatus = auditsatus;
                    jobflow.ruleid      = int.Parse(ddlApproval.SelectedValue);
                    JobFlowManager.Update(jobflow);
                }
            }
            return(result);
        }
        public void JobFlowEc2KeyNameIsMissing()
        {
            //Input
            JobFlow jobFlow = new JobFlow();

            jobFlow.Name       = "testName";
            jobFlow.LogUri     = "s3://myBucket/logs";
            jobFlow.AmiVersion = "3.0.3";

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            try
            {
                jobFlow.Accept(visitor);
                Assert.Fail("Exception has not been thrown!!!");
            }
            catch (InvalidOperationException ex)
            {
                Assert.IsFalse(visitorSubscriber.wasAnyEventFired, "None of the visitor's events should be fired!");
                Assert.AreEqual <string>("Ec2KeyName property is missing for the JobFlow. Example: \"testEC2Key\"", ex.Message, "Unexpected exception message");
            }
        }
        public void JobFlowInstanceCountShouldBeNotNegative()
        {
            //Input
            JobFlow jobFlow = new JobFlow();

            jobFlow.Name               = "testName";
            jobFlow.LogUri             = "s3://myBucket/logs";
            jobFlow.AmiVersion         = "3.0.3";
            jobFlow.Ec2KeyName         = "testEC2Key";
            jobFlow.HadoopVersion      = "2.2.0";
            jobFlow.MasterInstanceType = "m1.medium";
            jobFlow.SlaveInstanceType  = "m3.2xlarge";
            jobFlow.InstanceCount      = -1;

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            try
            {
                jobFlow.Accept(visitor);
                Assert.Fail("Exception has not been thrown!!!");
            }
            catch (InvalidOperationException ex)
            {
                Assert.IsFalse(visitorSubscriber.wasAnyEventFired, "None of the visitor's events should be fired!");
                Assert.AreEqual <string>("InstanceCount property of the JobFlow should be positive. Example: \"34\"", ex.Message, "Unexpected exception message");
            }
        }
Example #5
0
        /// <summary>
        /// 更新的方法
        /// </summary>
        private string AuditUpdate(string args, string auditstatus, int id)
        {
            To_OrderInfo orderModle = To_OrderInfoManager.getTo_OrderInfoById(id);
            JobFlow      jobModel   = JobFlowManager.GetModel(orderModle.JobflowID);

            jobModel.savestatus  = args;
            jobModel.auditstatus = auditstatus;
            JobFlowManager.Update(jobModel);
            return(orderModle.OrderNum);
        }
Example #6
0
        public void TestDeserialization()
        {
            //Expectation
            JobFlow jobFlowExpected = this.GetTestJobFlow();

            //Action
            XmlDocument jobFlowXml = new XmlDocument();

            jobFlowXml.Load("TestData/JobFlowTemplate.xml");
            JobFlow jobFlowActual = JobFlow.GetRecord(jobFlowXml.OuterXml);

            //Verify
            Assert.AreEqual(jobFlowExpected, jobFlowActual, "Unexpected jobflow deserialization result");
        }
Example #7
0
        protected void RpPolicy_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "DELETE")
            {
                int id = Convert.ToInt32(e.CommandArgument);

                //if (To_PolicyManager.deleteTo_Policy(id) > 0)
                //{
                //    To_PolicyDetailManager.DeleteByPolicy(id);
                //  RpPolicyBindData();
                //}
                Del(id);
            }
            if (e.CommandName == "refresh")
            {
                int jfid = int.Parse(e.CommandArgument.ToString());
                Refresh(jfid);
            }

            if (e.CommandName == "audit")
            {
                string[] args      = e.CommandArgument.ToString().Split(',');
                int      jobFlowID = int.Parse(args[0].Trim());
                int      policyID  = int.Parse(args[1].Trim());
                string   num       = args[2].Trim();

                JobFlow jobFlow = JobFlowManager.GetModel(jobFlowID);
                if (jobFlow.savestatus == "草稿" && jobFlow.auditstatus == "01")
                {
                    jobFlow.savestatus  = "已提交";
                    jobFlow.auditstatus = "01";
                    JobFlowManager.Update(jobFlow);

                    int ruleID = jobFlow.ruleid;
                    CreateApproval(ruleID, jobFlowID);

                    SendMessage(ruleID, num);

                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('送审成功');", true);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('该保单已送审,无需再次送审');", true);
                }
            }

            RpPolicyBindData();
        }
        public void VisitJobFlow()
        {
            //Init args
            JobFlow jobFlow = new JobFlow();

            jobFlow.Name           = "testName-{jobFlowId}";
            jobFlow.LogUri         = "{myBucket}/logs/";
            jobFlow.JobFlowRole    = "arn:{myRole}";
            jobFlow.AmiVersion     = "{amiVersion}";
            jobFlow.AdditionalInfo = "{ name: \"name1\", contact: \"{contact}\" }";
            jobFlow.Ec2KeyName     = "{ec2Key}";
            jobFlow.HadoopVersion  = "{hadoopVersion}";
            jobFlow.KeepJobFlowAliveWhenNoSteps = true;
            jobFlow.TerminationProtected        = true;
            jobFlow.MasterInstanceType          = "{masterInstanceType}";
            jobFlow.SlaveInstanceType           = "{slaveInstanceType}";
            jobFlow.InstanceCount = 34;

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            jobFlow.Accept(visitor);

            //Verify
            Assert.AreEqual(2, visitorSubscriber.TotalObjCount, "Unexpected number of objects created");

            RunJobFlowRequest actualJobFlowRequest = visitorSubscriber.jobFlowRequestList[0];

            Assert.AreEqual("testName-j-111AAABBBNJ2I", actualJobFlowRequest.Name, "Unexpected Name");
            Assert.AreEqual("s3://myBucket/logs/", actualJobFlowRequest.LogUri, "Unexpected LogUri");
            Assert.AreEqual("arn:SupperSlonic", actualJobFlowRequest.JobFlowRole, "Unexpected JobFlowRole");
            Assert.AreEqual("3.0.3", actualJobFlowRequest.AmiVersion, "Unexpected AmiVersion");
            Assert.AreEqual("{ name: \"name1\", contact: \"supperslonic.com\" }", actualJobFlowRequest.AdditionalInfo, "Unexpected AdditionalInfo");

            JobFlowInstancesConfig actualJobFlowInstancesConfig = visitorSubscriber.instanceConfigList[0];

            Assert.AreEqual("testEC2Key", actualJobFlowInstancesConfig.Ec2KeyName, "Unexpected Ec2KeyName");
            Assert.AreEqual("2.2.0", actualJobFlowInstancesConfig.HadoopVersion, "Unexpected HadoopVersion");
            Assert.IsTrue(actualJobFlowInstancesConfig.KeepJobFlowAliveWhenNoSteps, "Unexpected KeepJobFlowAliveWhenNoSteps");
            Assert.IsTrue(actualJobFlowInstancesConfig.TerminationProtected, "Unexpected TerminationProtected");
            Assert.AreEqual("m1.medium", actualJobFlowInstancesConfig.MasterInstanceType, "Unexpected MasterInstanceType");
            Assert.AreEqual("m3.2xlarge", actualJobFlowInstancesConfig.SlaveInstanceType, "Unexpected SlaveInstanceType");
            Assert.AreEqual(34, actualJobFlowInstancesConfig.InstanceCount, "Unexpected InstanceCount");
        }
        /// <summary>
        /// 删除订单
        /// </summary>
        /// <param name="id">订单的id值</param>
        private void Del(int id)
        {
            To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(id);

            if (orderinfo != null)
            {
                int     jobflowid = orderinfo.JobflowID;
                JobFlow model     = JobFlowManager.GetModel(jobflowid);

                string strdel = " jobflowid=" + jobflowid;
                AuditJobFlowManager.Delete(strdel);
                JobFlowManager.Delete(jobflowid);
                To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(id));
                To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(id));
                To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(id));
                To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(id));
            }
        }
Example #10
0
        /// <summary>
        /// 编辑订单
        /// </summary>
        /// <param name="id">订单id</param>
        private void Edit(int id)
        {
            To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(id);

            if (orderinfo != null)
            {
                int     jobflowid = orderinfo.JobflowID;
                JobFlow model     = JobFlowManager.GetModel(jobflowid);
                if (model == null || model.auditstatus != "01")
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('订单已删除或审核员已审核')</script>");
                }
                else
                {
                    Response.Redirect("UpdateOrder.aspx?id=" + Convert.ToInt32(id));
                }
            }
        }
Example #11
0
        protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e)
        {
            string delId = "";

            //先遍历取得选中项

            for (int i = 0; i < this.rpPoliy.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)(rpPoliy.Items[i].FindControl("cbx"));
                Label    lbl = (Label)rpPoliy.Items[i].FindControl("lbl");
                if (cbx != null || cbx.Text != "")
                {
                    if (cbx.Checked)
                    {
                        delId += lbl.Text + ",";
                    }
                }
            }
            //去掉最后一个,
            delId = (delId + ")").Replace(",)", "");
            IList check = delId.Split(',');


            for (int i = 0; i < check.Count; i++)
            {
                To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(Convert.ToInt32(check[i]));
                if (orderinfo != null)
                {
                    int     jobflowid = orderinfo.JobflowID;
                    JobFlow model     = JobFlowManager.GetModel(jobflowid);

                    string strdel = " jobflowid=" + jobflowid;
                    AuditJobFlowManager.Delete(strdel);
                    JobFlowManager.Delete(jobflowid);
                    To_OrderInfoManager.deleteTo_OrderInfo(Convert.ToInt32(check[i]));
                    To_OrderCollectDetialManager.deleteTo_OrderCollectDetialByOrderID(Convert.ToInt32(check[i]));
                    To_OrderPayDetialManager.deleteTo_OrderPayDetialByOrderID(Convert.ToInt32(check[i]));
                    To_OrderRefunDetialManager.deleteTo_OrderRefunDetialByOrderID(Convert.ToInt32(check[i]));
                }
            }

            BindData();
        }
Example #12
0
        /// <summary>
        /// 添加工作流管理
        /// </summary>
        /// <param name="args">保存或已提交</param>
        private int SavePolicyJob(string args, string auditsatus)
        {
            int     result  = 0;
            JobFlow jobflow = null;

            if (Request.Params["jobflowid"] == null || Request.Params["jobflowid"] == "")
            {
                string cuscode    = ""; //公司代码全称
                string codeformat = ""; //公司代码,不包含流水号
                string ordernum   = ""; //流水号

                StrNumbers(TxtSerialNum.Text.Trim(), out cuscode, out codeformat, out ordernum);

                jobflow             = new JobFlow();
                jobflow.savestatus  = args.ToString();
                jobflow.createtime  = DateTime.Now;
                jobflow.endtime     = DateTime.Now;
                jobflow.cname       = cuscode; //工作流名称
                jobflow.attachment  = "";      //附件上传(1表示有附件)
                jobflow.sort        = "02";
                jobflow.auditsort   = "";      //审核类型
                jobflow.auditstatus = auditsatus;
                jobflow.founderid   = ((LoginInfo)Session["login"]).Id;
                jobflow.txt         = "";
                jobflow.ruleid      = int.Parse(this.DdlIsVirify.SelectedValue); //审核流程图关联id
                result = JobFlowManager.AddAndGetId(jobflow);
            }
            else
            {
                result  = int.Parse(Request.Params["jobflowid"]);
                jobflow = JobFlowManager.GetModel(int.Parse(Request.Params["jobflowid"]));
                if (jobflow != null)
                {
                    jobflow.savestatus  = args.ToString();
                    jobflow.auditstatus = auditsatus;
                    jobflow.ruleid      = int.Parse(this.DdlIsVirify.SelectedValue);
                    JobFlowManager.Update(jobflow);
                }
            }
            return(result);
        }
        public void JobFlowNameIsMissing()
        {
            //Input
            JobFlow jobFlow = new JobFlow();

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            try
            {
                jobFlow.Accept(visitor);
                Assert.Fail("Exception has not been thrown!!!");
            }
            catch (InvalidOperationException ex)
            {
                Assert.IsFalse(visitorSubscriber.wasAnyEventFired, "None of the visitor's events should be fired!");
                Assert.AreEqual <string>("Name property is missing for the JobFlow. Example: \"my super job 1\"", ex.Message, "Unexpected exception message");
            }
        }
Example #14
0
        /// <summary>
        /// 删除保单
        /// </summary>
        /// <param name="id">保单的id值</param>
        private void Del(int id)
        {
            To_Policy policy = To_PolicyManager.getTo_PolicyById(id);

            if (policy != null)
            {
                int     jobflowid = policy.IsVerify;
                JobFlow model     = JobFlowManager.GetModel(jobflowid);
                if (model == null || model.auditstatus != "01")
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('保单已删除或审核员已审核')</script>");
                }
                else
                {
                    string strdel = " jobflowid=" + jobflowid;
                    AuditJobFlowManager.Delete(strdel);
                    JobFlowManager.Delete(jobflowid);
                    To_PolicyManager.deleteTo_Policy(id);
                    To_PolicyDetailManager.DeleteByPolicy(id);
                }
            }
        }
Example #15
0
        public static int Clear()
        {
            IList <To_Policy> idlist = To_PolicyService.getTo_PolicyAll();

            if (idlist.Count > 0)
            {
                for (int i = 0; i < idlist.Count; i++)
                {
                    To_Policy policy = To_PolicyManager.getTo_PolicyById(Convert.ToInt32(idlist[i].Id));
                    if (policy != null)
                    {
                        int     jobflowid = policy.IsVerify;
                        JobFlow model     = JobFlowManager.GetModel(jobflowid);
                        string  strdel    = " jobflowid=" + jobflowid;
                        AuditJobFlowManager.Delete(strdel);
                        JobFlowManager.Delete(jobflowid);
                    }
                }
            }

            return(To_PolicyService.Clear());
        }
Example #16
0
        /// <summary>
        /// 添加付款单位信息
        /// </summary>
        private void AddBase(string sort)
        {
            string cuscode    = ""; //公司代码全称
            string codeformat = ""; //公司代码,不包含流水号
            string ordernum   = ""; //流水号

            if (StrNumbers(this.factCode.Value, out cuscode, out codeformat, out ordernum))
            {
                EtNet_Models.JobFlow model = new JobFlow();
                model.attachment  = codeformat;
                model.txt         = ordernum;
                model.cname       = cuscode;
                model.sort        = "03"; //付款单位管理申请
                model.auditsort   = "";
                model.auditstatus = "01";
                model.createtime  = DateTime.Now;                                  //默认是当前时间
                model.endtime     = DateTime.Now;
                model.founderid   = ((EtNet_Models.LoginInfo)Session["login"]).Id; //登录人员的id
                //model.ruleid = int.Parse(this.ddlrule.SelectedValue);
                //if (sort == "save")
                //{
                //    model.savestatus = "草稿";
                //}
                //else
                //{
                //    model.savestatus = "已提交";
                //}
                //int maxid = EtNet_BLL.JobFlowManager.AddAndGetId(model); //工作流的id值
                //基本信息
                EtNet_Models.Factory fact = new EtNet_Models.Factory();
                fact.FactCode   = cuscode;
                fact.Codeformat = codeformat;
                fact.Ordernum   = ordernum;
                fact.FactType   = Convert.ToInt32(this.HidTypeID.Value);
                // cus.Province = this.ddlProvince.SelectedValue;
                //cus.City = this.ddlCity.SelectedValue;
                fact.FactshortName = this.cusshortname.Value.ToString();
                string[] addre = this.address.Text.ToString().Split(' ');// string[] sailing = args.Split('/');
                fact.Province = addre[0].ToString();
                fact.City     = addre[1].ToString();


                fact.FactCName    = this.cusCName.Value.ToString();
                fact.FactCAddress = this.cusCAddress.Value.ToString();
                fact.Used         = Convert.ToInt32(this.rbUsed.SelectedItem.Value);

                //联系人
                fact.LinkeName = this.linkName.Value.ToString();
                fact.Duty      = this.linkPost.Value.ToString();
                fact.Telephone = this.linkTel.Value.ToString();
                fact.Mobile    = this.linkMobile.Value.ToString();
                fact.Fax       = this.linkFax.Value.ToString();
                fact.Email     = this.linkEmail.Value.ToString();
                fact.QQ        = this.linkMsn.Value.ToString();
                fact.Skype     = this.linkSkype.Value.ToString();


                //银行信息
                fact.Bank        = this.bankName.Value.ToString();
                fact.AccountID   = this.bankCard.Value.ToString();
                fact.AccountName = this.bankMan.Value.ToString();
                fact.Remark      = this.bankremark.Value;
                fact.Inputname   = ((LoginInfo)Session["login"]).Id;
                fact.Inputdate   = DateTime.Now;
                int count = FactoryManager.addFactory(fact);
                if (count > 0)
                {
                    addlink();
                    addbank();

                    if (sort == "save")
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存成功!');location.href='../Supplier/Supplier.aspx'", true);
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('送审成功!');location.href='../Supplier/Supplier.aspx'", true);
                    }
                }
            }
        }
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the activity</param>
 /// <param name="jobFlow">JobFlow object</param>
 public StartJobActivity(string name, JobFlow jobFlow)
     : base(name)
 {
     this.jobFlow = jobFlow;
 }
Example #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the activity</param>
 /// <param name="jobFlowXml">XML Document describing JobFlow</param>
 public StartJobActivity(string name, XmlDocument jobFlowXml)
     : base(name)
 {
     this.jobFlow = JobFlow.GetRecord(jobFlowXml.OuterXml);
 }
Example #19
0
        protected void RpPaymentList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            object objArg  = e.CommandArgument;
            string cmdName = e.CommandName;

            if (cmdName == "DELETE")//删除
            {
                string[] arrArg    = objArg.ToString().Split(',');
                string   paymentID = arrArg[0];
                string   jobflowID = arrArg[1];

                JobFlow jobFlow = JobFlowManager.GetModel(Convert.ToInt32(jobflowID));


                if (jobFlow.auditstatus != "01" || jobFlow.savestatus == "已提交")
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "delete", "alert('该申请已通过或者是正在审核,不能删除');", true);
                }
                else
                {
                    //string paymentID = objArg.ToString();
                    string resultMsg             = DeletePayment(paymentID);
                    To_PaymentDetailManager pcdm = new To_PaymentDetailManager();
                    pcdm.DeleteByPayment(paymentID);
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "delete", string.Format("alert(\"{0}\");", resultMsg), true);
                }
            }

            if (cmdName == "EDIT")//编辑
            {
                string[] arrArg    = objArg.ToString().Split(',');
                string   paymentID = arrArg[0];
                string   jobflowID = arrArg[1];
                JobFlow  jobFlow   = JobFlowManager.GetModel(Convert.ToInt32(jobflowID));
                if (jobFlow.auditstatus == "01" && jobFlow.savestatus == "草稿")
                {
                    Response.Redirect("PaymentEdit.aspx?payid=" + paymentID + "&jobflowid=" + jobflowID);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "edit", "alert('该申请已通过或者是正在审核,不能编辑');", true);
                }
                return;
            }

            if (cmdName == "APPROVAL")//送审
            {
                string[] arrArg    = objArg.ToString().Split(',');
                int      jobflowID = int.Parse(arrArg[0]);
                string   paymentID = arrArg[1];
                string   serialNum = arrArg[2];

                JobFlow jobFlow = JobFlowManager.GetModel(jobflowID);
                if (jobFlow.savestatus == "草稿" && jobFlow.auditstatus == "01")
                {
                    jobFlow.savestatus  = "已提交";
                    jobFlow.auditstatus = "01";
                    JobFlowManager.Update(jobFlow);

                    int ruleID = jobFlow.ruleid;
                    CreateApproval(ruleID, jobflowID);

                    SendMessage(ruleID, serialNum);

                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('送审成功');", true);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('该申请已送审,无需再次送审');", true);
                }
            }

            if (cmdName == "RECOVER")
            {
                int jobflowID = Convert.ToInt32(objArg);
                Recover(jobflowID);
            }

            if (cmdName == "PRINT")
            {
                string[] args = objArg.ToString().Split(',');
                if (args[1].Trim() != "04")
                {
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "aa", "alert('未通过审核申请不能打印')", true);
                }
                else
                {
                    Print(args[0].Trim());
                }

                return;
            }

            BindPaymentList();
        }
Example #20
0
        //通过审核
        protected void imgbtnpass_Click(object sender, ImageClickEventArgs e)
        {
            int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id

            EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"];

            string comparedata = " reviewerid=" + login.Id + " AND jobflowid=" + jobflowid.ToString();

            if (AuditJobFlowManager.GetList(comparedata).Rows.Count == 0)
            {
                //该工作流被收回或删除导致审批提交失败
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
            else if (JobFlowManager.GetModel(jobflowid).auditstatus == "03" || JobFlowManager.GetModel(jobflowid).auditstatus == "04")
            {
                //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
            else
            {
                JobFlow      jobflow = JobFlowManager.GetModel(jobflowid);
                ApprovalRule rule    = ApprovalRuleManager.GetModel(jobflow.ruleid);
                string       ruletxt = rule.sort; //审核的分类

                //修改当前审核人的记录
                AuditJobFlow auditmodel   = null;
                string       auditstr     = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((LoginInfo)Session["login"]).Id;
                DataTable    audittbl     = AuditJobFlowManager.GetList(auditstr);             // 查找到当前审核人员的记录
                int          num          = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号
                string       mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();       //当前审核人是不是最终审核人

                auditmodel              = new AuditJobFlow();
                auditmodel.auditoperat  = "通过";
                auditmodel.audittime    = DateTime.Now;
                auditmodel.id           = int.Parse(audittbl.Rows[0]["id"].ToString());
                auditmodel.jobflowid    = int.Parse(audittbl.Rows[0]["jobflowid"].ToString());
                auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();
                auditmodel.nowreviewer  = "P"; //能查找到工作流记录,但不能进行审核操作
                auditmodel.numbers      = int.Parse(audittbl.Rows[0]["numbers"].ToString());
                auditmodel.operatstatus = "已审批";
                auditmodel.reviewerid   = int.Parse(audittbl.Rows[0]["reviewerid"].ToString());
                auditmodel.opiniontxt   = Server.UrlDecode(this.treatxt.Value.Trim());
                AuditJobFlowManager.Update(auditmodel);



                //依据不同的审核类型进行操作
                switch (ruletxt)
                {
                case "单审":
                    if (mainreviewer != "T")
                    {
                        auditmodel = new AuditJobFlow();     //设置下一个审核人的数据记录
                        string    nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString();
                        DataTable nextaudittbl = AuditJobFlowManager.GetList(nextauditstr);
                        auditmodel.auditoperat  = nextaudittbl.Rows[0]["auditoperat"].ToString();
                        auditmodel.audittime    = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString());
                        auditmodel.id           = int.Parse(nextaudittbl.Rows[0]["id"].ToString());
                        auditmodel.jobflowid    = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString());
                        auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString();
                        auditmodel.nowreviewer  = "T";    //设置其为审核人员
                        auditmodel.numbers      = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString());
                        auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString();
                        auditmodel.reviewerid   = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString());
                        auditmodel.opiniontxt   = nextaudittbl.Rows[0]["opiniontxt"].ToString();
                        AuditJobFlowManager.Update(auditmodel);
                        jobflow.auditstatus = "02";     //工作流的审核状态为“进行中”
                        JobFlowManager.Update(jobflow);
                    }
                    else
                    {
                        jobflow.endtime     = DateTime.Now;
                        jobflow.auditstatus = "04";     //工作流的审核状态为“已通过”
                        JobFlowManager.Update(jobflow);
                    }
                    break;

                case "选审":

                    jobflow.endtime     = DateTime.Now;
                    jobflow.auditstatus = "04";     //工作流的审核状态为“已通过”
                    JobFlowManager.Update(jobflow);
                    break;

                case "会审":
                    bool      pass        = true;
                    string    strsql      = " jobflowid=" + jobflowid.ToString();
                    DataTable auditjobtbl = AuditJobFlowManager.GetList(strsql);
                    for (int i = 0; i < auditjobtbl.Rows.Count; i++)
                    {
                        if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过")
                        {
                            pass = false;     //说明还有其他审核人员未开始审核
                            break;
                        }
                    }

                    if (pass)
                    {
                        jobflow.endtime     = DateTime.Now;
                        jobflow.auditstatus = "04";     //工作流的状审核状态为“已通过”
                        JobFlowManager.Update(jobflow);
                    }
                    else
                    {
                        jobflow.auditstatus = "02";     //工作流的状审核状态为“进行中”
                        JobFlowManager.Update(jobflow);
                    }
                    break;
                }

                string    sqlpolicy           = " isVerify =" + jobflowid.ToString();
                DataTable tblpolicy           = EtNet_BLL.To_PolicyManager.GetList(1, sqlpolicy, "id");
                EtNet_Models.To_Policy policy = EtNet_BLL.To_PolicyManager.getTo_PolicyById(int.Parse(tblpolicy.Rows[0]["id"].ToString()));
                if (policy.Txt == "")
                {
                    policy.Txt = login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim());
                }
                else
                {
                    policy.Txt = policy.Txt + "|" + login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim());
                }
                EtNet_BLL.To_PolicyManager.updateTo_Policy(policy);

                SendMessage("【" + login.Cname + "】通过审批");
                SendNextAudit(jobflowid);
                Response.Redirect("../Job/AuditJobFlow.aspx");
            }
        }
Example #21
0
        /// <summary>
        /// 添加订单信息
        /// </summary>
        private void AddBase(string sort)
        {
            string cuscode    = ""; //公司代码全称
            string codeformat = ""; //公司代码,不包含流水号
            string ordernum   = ""; //流水号

            if (StrNumbers(this.txtOrderCode.Value, out cuscode, out codeformat, out ordernum))
            {
                int maxid = 0;
                EtNet_Models.JobFlow model = new JobFlow();
                model.attachment = codeformat;
                model.txt        = ordernum;
                model.cname      = cuscode;
                model.sort       = "02"; //订单申请
                model.auditsort  = "";

                model.createtime = DateTime.Now;                                  //默认是当前时间
                model.endtime    = DateTime.Now;
                model.founderid  = ((EtNet_Models.LoginInfo)Session["login"]).Id; //登录人员的id
                model.ruleid     = int.Parse(this.DdlIsVirify.SelectedValue);
                if (sort == "save")
                {
                    model.savestatus  = "草稿";
                    model.auditstatus = "01";
                    maxid             = EtNet_BLL.JobFlowManager.AddAndGetId(model); //工作流的id值
                }
                else
                {
                    model.savestatus  = "已提交";
                    model.auditstatus = "02";
                    maxid             = EtNet_BLL.JobFlowManager.AddAndGetId(model); //工作流的id值
                    CreateApproval(int.Parse(this.DdlIsVirify.SelectedValue), maxid);
                    SendMessage(maxid.ToString());
                }


                //基本信息
                EtNet_Models.To_OrderInfo order = new EtNet_Models.To_OrderInfo();
                order.OrderNum      = cuscode;
                order.Codeformat    = codeformat;
                order.Codenum       = ordernum;
                order.JobflowID     = Convert.ToInt32(this.DdlIsVirify.SelectedValue);
                order.MakerName     = ((LoginInfo)Session["login"]).Cname;
                order.MakerTime     = DateTime.Now;
                order.MarkId        = ((LoginInfo)Session["login"]).Id;
                order.Natrue        = this.ddlnature.SelectedValue; //订单类型
                order.OrderType     = this.DropDownList1.SelectedValue;
                order.OutTime       = Convert.ToDateTime(this.txtOutDate.Value);
                order.CollectCusID  = "";
                order.CollectAmount = Convert.ToDouble(lblCollAmount.Value); //收款金额合计
                order.PayAmount     = Convert.ToDouble(lblPayAmount.Value);  //付款金额合计
                order.PayCusID      = "";
                order.RefundAmount  = Convert.ToDouble(lblBackAmount.Value); //退款金额合计
                order.RefundID      = "";
                order.ReimAmount    = Convert.ToDouble(0);
                order.ReimID        = "";
                order.Gross         = Convert.ToDouble(lblCollAmount.Value) - Convert.ToDouble(lblPayAmount.Value) + Convert.ToDouble(lblBackAmount.Value); //预计毛利
                order.TeamNum       = txtTeamnum.Value;
                order.Tour          = this.ddlLine.SelectedValue;
                order.TourRemark    = this.txtRemark.Value;
                order.Verify        = Convert.ToInt32(this.DdlIsVirify.SelectedValue);
                order.JobflowID     = maxid;

                //操作人员
                order.Inputer   = ddlInputer.SelectedItem.Text;
                order.InputerID = Convert.ToInt32(ddlInputer.SelectedValue);
                order.InputerTc = order.Gross * LoginInfoManager.getLoginInfoById(order.InputerID).orderRate; //操作员提成金额
                order.Gross     = order.Gross - order.InputerTc;                                              //预计毛利还得减掉操作员在该笔订单中所占的提成(毛利*提成系数)

                //部门编码标识符
                DepartmentInfo depart = DepartmentInfoManager.getDepartmentInfoById(((LoginInfo)Session["login"]).Departid);
                if (depart != null)
                {
                    order.DepartAutoCode = depart.AutoCode;
                }
                else
                {
                    order.DepartAutoCode = "";
                }

                //订单是否作废
                order.IsCancel = "N";

                int count = To_OrderInfoManager.addTo_OrderInfo(order);
                if (count > 0)
                {
                    addlink(count);
                    addbank(count);
                    addback(count);
                    if (sort == "save")
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存成功!');location.href='OrderList.aspx'", true);
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('送审成功!');location.href='OrderList.aspx'", true);
                    }
                }
            }
        }
 public RunJobFlowRequest Build(JobFlow jobFlow)
 {
     jobFlow.Accept(this.visitor);
     return(this.result);
 }
        public void Visit(JobFlow jobFlow)
        {
            if (String.IsNullOrEmpty(jobFlow.Name))
            {
                throw new InvalidOperationException(Resources.E_JobFlowNameIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.LogUri))
            {
                throw new InvalidOperationException(Resources.E_JobFlowLogUriIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.AmiVersion))
            {
                throw new InvalidOperationException(Resources.E_JobFlowAmiVersionIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.Ec2KeyName))
            {
                throw new InvalidOperationException(Resources.E_JobFlowEc2KeyNameIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.HadoopVersion))
            {
                throw new InvalidOperationException(Resources.E_JobFlowHadoopVersionIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.MasterInstanceType))
            {
                throw new InvalidOperationException(Resources.E_JobFlowMasterInstanceTypeIsMissing);
            }

            if (String.IsNullOrEmpty(jobFlow.SlaveInstanceType))
            {
                throw new InvalidOperationException(Resources.E_JobFlowSlaveInstanceTypeIsMissing);
            }

            if (jobFlow.InstanceCount <= 0)
            {
                throw new InvalidOperationException(Resources.E_JobFlowInstanceCountShouldBePositive);
            }

            RunJobFlowRequest jobFlowRequest = new RunJobFlowRequest();

            jobFlowRequest.Name           = this.settings.FillPlaceHolders(jobFlow.Name);
            jobFlowRequest.LogUri         = this.settings.FillPlaceHolders(jobFlow.LogUri);
            jobFlowRequest.JobFlowRole    = this.settings.FillPlaceHolders(jobFlow.JobFlowRole);
            jobFlowRequest.AmiVersion     = this.settings.FillPlaceHolders(jobFlow.AmiVersion);
            jobFlowRequest.AdditionalInfo = this.settings.FillPlaceHolders(jobFlow.AdditionalInfo);

            if (this.OnRunJobFlowRequestCreated != null)
            {
                this.OnRunJobFlowRequestCreated(this, jobFlowRequest);
            }

            JobFlowInstancesConfig instancesConfig = new JobFlowInstancesConfig();

            instancesConfig.Ec2KeyName    = this.settings.FillPlaceHolders(jobFlow.Ec2KeyName);
            instancesConfig.HadoopVersion = this.settings.FillPlaceHolders(jobFlow.HadoopVersion);
            instancesConfig.KeepJobFlowAliveWhenNoSteps = jobFlow.KeepJobFlowAliveWhenNoSteps;
            instancesConfig.TerminationProtected        = jobFlow.TerminationProtected;
            instancesConfig.MasterInstanceType          = this.settings.FillPlaceHolders(jobFlow.MasterInstanceType);
            instancesConfig.SlaveInstanceType           = this.settings.FillPlaceHolders(jobFlow.SlaveInstanceType);
            instancesConfig.InstanceCount = jobFlow.InstanceCount;

            if (this.OnJobFlowInstancesConfigCreated != null)
            {
                this.OnJobFlowInstancesConfigCreated(this, instancesConfig);
            }
        }
        public void CanBuild()
        {
            //Input
            XmlDocument jobFlowXml = new XmlDocument();

            jobFlowXml.Load("TestData/JobFlowTemplate.xml");
            JobFlow jobFlow = JobFlow.GetRecord(jobFlowXml.OuterXml);

            //Action
            RunJobFlowRequestBuilder builder = new RunJobFlowRequestBuilder(RunJobFlowRequestBuilderTest.GetSettings());
            RunJobFlowRequest        actual  = builder.Build(jobFlow);

            //Verfiy

            //Main properties
            Assert.AreEqual("Name1", actual.Name, "Unexpected Name");
            Assert.AreEqual("s3://myBucket/logs", actual.LogUri, "Unexpected LogUri");
            Assert.AreEqual("test job flow role", actual.JobFlowRole, "Unexpected JobFlowRole");
            Assert.AreEqual("3.0.3", actual.AmiVersion, "Unexpected AmiVersion");
            Assert.AreEqual("{ test: \"lala\", \"key\" : \"value\"}", actual.AdditionalInfo, "Unexpected AdditionalInfo");

            //JobFlowInstancesConfig
            Assert.AreEqual("testEC2Key", actual.Instances.Ec2KeyName, "Unexpected Ec2KeyName");
            Assert.AreEqual("2.2.0", actual.Instances.HadoopVersion, "Unexpected HadoopVersion");
            Assert.IsTrue(actual.Instances.KeepJobFlowAliveWhenNoSteps, "Unexpected KeepJobFlowAliveWhenNoSteps");
            Assert.IsTrue(actual.Instances.TerminationProtected, "Unexpected TerminationProtected");
            Assert.AreEqual("m1.medium", actual.Instances.MasterInstanceType, "Unexpected MasterInstanceType");
            Assert.AreEqual("m3.2xlarge", actual.Instances.SlaveInstanceType, "Unexpected SlaveInstanceType");
            Assert.AreEqual(34, actual.Instances.InstanceCount, "Unexpected InstanceCount");

            //Tags
            Assert.AreEqual(2, actual.Tags.Count, "Unexpected amount of tags");
            Assert.AreEqual("Contact", actual.Tags[0].Key, "Unexpected Key");
            Assert.AreEqual("Supperslonic.com", actual.Tags[0].Value, "Unexpected Value");
            Assert.AreEqual("Environment", actual.Tags[1].Key, "Unexpected Key");
            Assert.AreEqual("test", actual.Tags[1].Value, "Unexpected Value");

            //BootstrapActions
            int index = 0;
            BootstrapActionConfig bootstrap;

            Assert.AreEqual(6, actual.BootstrapActions.Count, "Unexpected amount of bootstrapActions");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("Configure Hadoop", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/configure-hadoop", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsTrue(new List <string>()
            {
                "-s", "mapreduce.map.memory.mb=8192", "-s", "mapreduce.user.classpath.first=true"
            }.SequenceEqual(bootstrap.ScriptBootstrapAction.Args), "Unexpected args list");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("Install HBase", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/setup-hbase", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsNull(bootstrap.ScriptBootstrapAction.Args, "Unexpected args list");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("Configure HBase", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/configure-hbase", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsTrue(new List <string>()
            {
                "--site-config-file", "s3://myBucket/hBase/config.xml"
            }.SequenceEqual(bootstrap.ScriptBootstrapAction.Args), "Unexpected args list");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("Configure HBase Daemons", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/configure-hbase-daemons", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsTrue(new List <string>()
            {
                "--hbase-master-opts=-Xmx6140M -XX:NewSize=64m", "--regionserver-opts=-XX:MaxNewSize=64m -XX:+HeapDumpOnOutOfMemoryError"
            }.SequenceEqual(bootstrap.ScriptBootstrapAction.Args), "Unexpected args list");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("bootstrap action 1", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://myBucket/bootstrap/UploadLibraries.sh", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsNull(bootstrap.ScriptBootstrapAction.Args, "Unexpected args list");

            bootstrap = actual.BootstrapActions[index++];
            Assert.AreEqual("bootstrap action 2", bootstrap.Name, "Unexpected Name");
            Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/install-ganglia", bootstrap.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path");
            Assert.IsTrue(new List <string>()
            {
                "true", "4"
            }.SequenceEqual(bootstrap.ScriptBootstrapAction.Args), "Unexpected args list");

            //Steps
            index = 0;
            StepConfig step;

            Assert.AreEqual(6, actual.Steps.Count, "Unexpected amount of steps");

            step = actual.Steps[index++];
            Assert.AreEqual("Start debugging", step.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.CONTINUE, step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("s3://elasticmapreduce/libs/script-runner/script-runner.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.IsNull(step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(new List <string>()
            {
                "s3://elasticmapreduce/libs/state-pusher/0.1/fetch"
            }.SequenceEqual(step.HadoopJarStep.Args), "Unexpected args list");

            step = actual.Steps[index++];
            Assert.AreEqual("Start HBase", step.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.TERMINATE_JOB_FLOW, step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("/home/hadoop/lib/hbase-0.94.7.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.AreEqual("emr.hbase.backup.Main", step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(new List <string>()
            {
                "--start-master"
            }.SequenceEqual(step.HadoopJarStep.Args), "Unexpected args list");

            step = actual.Steps[index++];
            Assert.AreEqual("Restore HBase", step.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.TERMINATE_JOB_FLOW, step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("/home/hadoop/lib/hbase-0.94.7.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.AreEqual("emr.hbase.backup.Main", step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(new List <string>()
            {
                "--restore", "--backup-dir", "s3://myBucket/hBaseRestore"
            }.SequenceEqual(step.HadoopJarStep.Args), "Unexpected args list");

            step = actual.Steps[index++];
            Assert.AreEqual("step 1", step.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.CANCEL_AND_WAIT, step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("s3://myBucket/jars/test.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.AreEqual("com.supperslonic.emr.Step1Driver", step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(new List <string>()
            {
                "true", "12.34", "hello"
            }.SequenceEqual(step.HadoopJarStep.Args), "Unexpected args list");

            step = actual.Steps[index++];
            Assert.AreEqual("Backup HBase", step.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.TERMINATE_JOB_FLOW, step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("/home/hadoop/lib/hbase-0.94.7.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.AreEqual("emr.hbase.backup.Main", step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(new List <string>()
            {
                "--backup", "--backup-dir", "s3://myBucket/hBaseBackup"
            }.SequenceEqual(step.HadoopJarStep.Args), "Unexpected args list");

            step = actual.Steps[index++];
            Assert.AreEqual("step 2", step.Name, "Unexpected Name");
            Assert.IsNull(step.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("s3://myBucket/jars/test2.jar", step.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.IsNull(step.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsNull(step.HadoopJarStep.Args, "Unexpected args list");
        }
Example #25
0
        private void AddBase(string sort)
        {
            string cuscode    = ""; //公司代码全称
            string codeformat = ""; //公司代码,不包含流水号
            string ordernum   = ""; //流水号

            if (StrNumbers(this.cusCode.Value, out cuscode, out codeformat, out ordernum))
            {
                EtNet_Models.JobFlow model = new JobFlow();
                model.attachment  = codeformat;
                model.txt         = ordernum;
                model.cname       = cuscode;
                model.sort        = "03"; //客户管理申请
                model.auditsort   = "";
                model.auditstatus = "01";
                model.createtime  = DateTime.Now;                                  //默认是当前时间
                model.endtime     = DateTime.Now;
                model.founderid   = ((EtNet_Models.LoginInfo)Session["login"]).Id; //登录人员的id
                model.ruleid      = int.Parse(this.ddlrule.SelectedValue);
                if (sort == "save")
                {
                    model.savestatus = "草稿";
                }
                else
                {
                    model.savestatus = "已提交";
                }
                int maxid = EtNet_BLL.JobFlowManager.AddAndGetId(model); //工作流的id值

                if (sort != "save")
                {
                    CreateApproval(model.ruleid, maxid);
                    SendInformation(maxid, model.ruleid);
                }


                //基本信息
                EtNet_Models.Customer cus = new EtNet_Models.Customer();
                // cus.Id = Convert.ToInt32(Request.QueryString["id"].ToString());
                cus.CusCode      = cuscode;
                cus.Codeformat   = codeformat;
                cus.Ordernum     = ordernum;
                cus.CusshortName = this.cusshortname.Value.ToString();
                cus.Jobflowid    = maxid;
                cus.Txt          = "";
                cus.Viewidlist   = "";
                cus.Viewidtxt    = "";
                cus.Authidlist   = "";
                cus.Authidtxt    = "";

                //cus.Province = this.ddlProvince.SelectedValue;
                //cus.City = this.ddlCity.SelectedValue;
                cus.CusType = Convert.ToInt32(this.HidTypeID.Value);
                string[] addre = this.address.Text.ToString().Split(' ');// string[] sailing = args.Split('/');
                cus.Province    = addre[0].ToString();
                cus.City        = addre[1].ToString();
                cus.CusCName    = this.cusCName.Value.ToString();
                cus.CompanyURL  = this.companyURL.Value.ToString();
                cus.CusCAddress = this.cusCAddress.Value.ToString();
                cus.CusPro      = Convert.ToInt32(this.rbPro.SelectedItem.Value);
                //cus.Used = Convert.ToInt32(this.rbUsed.SelectedItem.Value);
                //联系人
                cus.LinkName  = this.linkName.Value.ToString();
                cus.Post      = this.linkPost.Value.ToString();
                cus.Telephone = this.linkTel.Value.ToString();
                cus.Mobile    = this.linkMobile.Value.ToString();
                cus.Fax       = this.linkFax.Value.ToString();
                cus.Email     = this.linkEmail.Value.ToString();
                cus.Msn       = this.linkMsn.Value.ToString();
                cus.Skype     = this.linkSkype.Value.ToString();
                cus.Madefrom  = ((LoginInfo)Session["Login"]).Id;
                cus.MadeTime  = DateTime.Now;
                //银行信息
                cus.Bank     = this.bankName.Value.ToString();
                cus.CardId   = this.bankCard.Value.ToString();
                cus.CardName = this.bankMan.Value.ToString();
                cus.Remark   = this.bankremark.Value.ToString();
                cus.Madefrom = ((LoginInfo)Session["login"]).Id;
                cus.MadeTime = DateTime.Now;
                int count = CustomerManager.addCustomer(cus);
                if (count > 0)
                {
                    addbank();
                    addlink();
                    if (sort == "save")
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存成功!');location.href='../CusInfo/Customer.aspx'", true);
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('送审成功!');location.href='../CusInfo/Customer.aspx'", true);
                    }
                }
            }
        }
Example #26
0
        /// <summary>
        /// 操作
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void cuslist_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            To_OrderInfo orderinfo = To_OrderInfoManager.getTo_OrderInfoById(Convert.ToInt32(e.CommandArgument));

            switch (e.CommandName)
            {
            case "Delete":
                Del(Convert.ToInt32(e.CommandArgument));
                //To_OrderReimDetialManager.deleteTo_OrderReimDetialByOrderID(Convert.ToInt32(e.CommandArgument));
                break;

            case "Edit":
                if (orderinfo != null)
                {
                    int     jobflowid = orderinfo.JobflowID;
                    JobFlow model     = JobFlowManager.GetModel(jobflowid);
                    if (model.savestatus == "草稿" && model.auditstatus == "01")
                    {
                        Edit(Convert.ToInt32(e.CommandArgument));
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "edit", "alert('该订单已送审,无法修改,欲修改请先回收');", true);
                    }
                }
                break;

            case "Detial":
                Response.Redirect("OrderDetial.aspx?id=" + Convert.ToInt32(e.CommandArgument));
                break;

            case "Audit":
                if (orderinfo != null)
                {
                    int     jobflowid = orderinfo.JobflowID;
                    JobFlow model     = JobFlowManager.GetModel(jobflowid);
                    if (model == null || model.auditstatus != "01" || model.savestatus == "已提交")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('订单已删除或订单已经送审或审核员已审核')</script>");
                    }
                    else
                    {
                        To_OrderInfo orderModle = To_OrderInfoManager.getTo_OrderInfoById(Convert.ToInt32(e.CommandArgument));
                        JobFlow      jobModel   = JobFlowManager.GetModel(orderModle.JobflowID);
                        string       ordernum   = AuditUpdate("已提交", "01", Convert.ToInt32(e.CommandArgument));
                        CreateApproval(jobModel.ruleid, orderModle.JobflowID);
                        SendMessage(ordernum.ToString(), jobModel.ruleid);
                    }
                }

                break;

            case "Refresh":
                orderinfo = To_OrderInfoManager.getTo_OrderInfoById(Convert.ToInt32(e.CommandArgument));
                Refresh(orderinfo.JobflowID);
                break;

            case "File":
                To_OrderInfoManager.updateFileStatus(1, Convert.ToInt32(e.CommandArgument));
                break;

            case "delFile":
                To_OrderInfoManager.updateFileStatus(0, Convert.ToInt32(e.CommandArgument));
                break;
            }
            OrderListBind();
        }
Example #27
0
        private JobFlow GetTestJobFlow()
        {
            JobFlow jobFlow = new JobFlow();

            jobFlow.Name                        = "Name1";
            jobFlow.LogUri                      = "{myBucket}/logs";
            jobFlow.Ec2KeyName                  = "testEC2Key";
            jobFlow.JobFlowRole                 = "test job flow role";
            jobFlow.AmiVersion                  = "3.0.3";
            jobFlow.HadoopVersion               = "2.2.0";
            jobFlow.MasterInstanceType          = "m1.medium";
            jobFlow.SlaveInstanceType           = "m3.2xlarge";
            jobFlow.InstanceCount               = 34;
            jobFlow.KeepJobFlowAliveWhenNoSteps = true;
            jobFlow.TerminationProtected        = true;
            jobFlow.AdditionalInfo              = "{ test: \"lala\", \"key\" : \"value\"}";
            jobFlow.Tags                        = new List <ClusterTag>()
            {
                new ClusterTag()
                {
                    Key = "Contact", Value = "Supperslonic.com"
                },
                new ClusterTag()
                {
                    Key = "Environment", Value = "test"
                }
            };

            //================== Configs ==================
            IList <ConfigBase> configs = new List <ConfigBase>();

            configs.Add(new DebugConfig()
            {
                IfStart = true
            });
            configs.Add(new HadoopConfig()
            {
                Args = new List <String>()
                {
                    "-s", "mapreduce.map.memory.mb={mapreduce_map_memory_mb}", "-s", "mapreduce.user.classpath.first=true"
                }
            });

            configs.Add(new HBaseConfig()
            {
                IfStart = true,
                JarPath = "{hbaseJar}",
                Args    = new List <String>()
                {
                    "--site-config-file", "{myBucket}/hBase/config.xml"
                },
                HBaseDaemondsConfigArgs = new HBaseDaemonsConfig()
                {
                    Args = new List <String>()
                    {
                        "--hbase-master-opts=-Xmx6140M -XX:NewSize=64m", "--regionserver-opts=-XX:MaxNewSize=64m -XX:+HeapDumpOnOutOfMemoryError"
                    }
                }
            });
            jobFlow.Configs = configs;

            //================== BootstrapActions ==================
            IList <BootstrapAction> bootstrapActions = new List <BootstrapAction>();

            bootstrapActions.Add(new BootstrapAction()
            {
                Name = "bootstrap action 1",
                Path = "{myBucket}/bootstrap/UploadLibraries.sh"
            });
            bootstrapActions.Add(new BootstrapAction()
            {
                Name = "bootstrap action 2",
                Path = "s3://elasticmapreduce/bootstrap-actions/install-ganglia",
                Args = new List <String>()
                {
                    "true", "4"
                }
            });
            jobFlow.BootstrapActions = bootstrapActions;

            //================== Steps ==================
            IList <StepBase> steps = new List <StepBase>();

            steps.Add(new HBaseRestoreStep()
            {
                HBaseJarPath = "{hbaseJar}", RestorePath = "{myBucket}/hBaseRestore"
            });
            steps.Add(new JarStep()
            {
                Name            = "step 1",
                JarPath         = "{myBucket}/jars/test.jar",
                ActionOnFailure = ActionOnFailure.CANCEL_AND_WAIT,
                MainClass       = "com.supperslonic.emr.Step1Driver",
                Args            = new List <String>()
                {
                    "true", "12.34", "hello"
                }
            });
            steps.Add(new HBaseBackupStep {
                HBaseJarPath = "{hbaseJar}", BackupPath = "{myBucket}/hBaseBackup"
            });
            steps.Add(new JarStep()
            {
                Name    = "step 2",
                JarPath = "{myBucket}/jars/test2.jar"
            });

            jobFlow.Steps = steps;

            return(jobFlow);
        }