Esempio n. 1
0
        public static bool IsIndoorIsValidForODUSeries(JCHVRF.Model.NextGen.SystemVRF CurrentSys)
        {
            var listRISelected = JCHVRF.Model.Project.GetProjectInstance.RoomIndoorList.Where(ri => ri.SystemID == (((JCHVRF.Model.SystemBase)CurrentSys).Id)).ToList();

            if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
            {
                MyProductTypeBLL productTypeBll = new MyProductTypeBLL();
                DataTable        typeDt         = productTypeBll.GetIduTypeBySeries(JCHVRF.Model.Project.GetProjectInstance.BrandCode, JCHVRF.Model.Project.GetProjectInstance.SubRegionCode, CurrentSys.Series);
                if (typeDt != null && typeDt.Rows.Count > 0)
                {
                    foreach (var idu in listRISelected)
                    {
                        if (idu.IndoorItem != null)
                        {
                            if (!typeDt.AsEnumerable().Any(row => row["IDU_UnitType"].ToString() == idu.IndoorItem.Type))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                IndoorBLL bll     = new IndoorBLL(JCHVRF.Model.Project.GetProjectInstance.SubRegionCode, JCHVRF.Model.Project.GetProjectInstance.BrandCode);
                string    colName = "UnitType";
                DataTable typeDt  = bll.GetIndoorFacCodeList(CurrentSys.ProductType);
                foreach (DataRow dr in typeDt.Rows)
                {
                    if (System.Convert.ToInt32(dr["FactoryCount"].ToString()) > 1)
                    {
                        dr[colName] = AlterUnitTypeBasedOnFactoryCode(dr["FactoryCode"].ToString(), Convert.ToString(dr[colName]));
                    }
                }
                var dv = new DataView(typeDt);
                if (CurrentSys.ProductType == "Comm. Tier 2, HP")
                {
                    if (CurrentSys.Series == "Commercial VRF HP, FSN6Q" || CurrentSys.Series == "Commercial VRF HP, JVOH-Q")
                    {
                        dv.RowFilter = "UnitType not in ('High Static Ducted-HAPE','Medium Static Ducted-HAPE','Low Static Ducted-HAPE','High Static Ducted-SMZ','Medium Static Ducted-SMZ','Four Way Cassette-SMZ')";
                    }
                    else
                    {
                        dv.RowFilter = "UnitType <>'Four Way Cassette-HAPQ'";
                    }
                }
                typeDt = dv.Table;
                if (typeDt != null && typeDt.Rows.Count > 0)
                {
                    foreach (var idu in listRISelected)
                    {
                        if (idu.IndoorItem != null)
                        {
                            var factoryCode = idu.IndoorItem.GetFactoryCode();
                            var type        = AlterUnitTypeBasedOnFactoryCode(factoryCode, idu.IndoorItem.Type);


                            if (!typeDt.AsEnumerable().Any(row => (row["UnitType"].ToString() == idu.IndoorItem.Type ||
                                                                   (System.Convert.ToInt32(row["FactoryCount"].ToString()) > 1 && row["UnitType"].ToString() == type))))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
    protected void ProjectsRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int projectId = 0;

        try
        {
            projectId = Convert.ToInt32(e.CommandArgument);
        }
        catch (Exception ex)
        {
            log.Error("Error getting object id", ex);
        }
        if (projectId <= 0)
        {
            SystemMessages.DisplaySystemErrorMessage(Resources.Organization.MessageNoComplete);
            return;
        }

        if (e.CommandName == "EditProject")
        {
            Session["ProjectId"]  = projectId;
            Session["ParentPage"] = "~/Project/ProjectList.aspx";
            Response.Redirect("~/Project/ProjectForm.aspx");
            return;
        }

        if (e.CommandName == "ViewProject")
        {
            Session["ProjectId"] = projectId;
            Response.Redirect("~/Project/ProjectDetails.aspx");
            return;
        }

        if (e.CommandName == "DeleteProject")
        {
            try
            {
                ProjectBLL.DeleteProject(projectId);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }

            SystemMessages.DisplaySystemMessage(Resources.Organization.MessageDeleteProjectOK);
            ProjectsRepeater.DataBind();
            return;
        }
        if (e.CommandName == "ViewActivities")
        {
            Session["SEARCH_PARAMETER"] = "@projectID " + projectId.ToString();
            Response.Redirect("~/Activity/ActivitiesList.aspx");
            return;
        }
        if (e.CommandName == "ViewKPIs")
        {
            Session["SEARCH_PARAMETER"] = "@projectID " + projectId.ToString();
            Response.Redirect("~/Kpi/KpiList.aspx");
            return;
        }
        if (e.CommandName == "ViewOrganization")
        {
            Session["SEARCH_PARAMETER"] = "@organizationID " + projectId.ToString();
            Response.Redirect("~/Organization/ListOrganizations.aspx");
            return;
        }
        if (e.CommandName == "ViewArea")
        {
            Session["OrganizationId"] = projectId.ToString();
            Response.Redirect("~/Organization/EditOrganization.aspx");
            return;
        }
        if (e.CommandName.Equals("ShareProject"))
        {
            Session["PROJECTID"] = projectId.ToString();
            Response.Redirect("~/Project/ShareProject.aspx");
        }
    }
Esempio n. 3
0
        /// <summary>
        /// Method to fetch project details and assign to textbox
        /// </summary>
        protected void GetProjectDetails()
        {
            ProjectBLL objProjectBLL = new ProjectBLL();
            ProjectBO  objProject    = objProjectBLL.GetProjectByProjectID(Convert.ToInt32(Session["PROJECT_ID"]));

            if (!string.IsNullOrEmpty(objProject.ProjectCode))
            {
                Session["PROJECT_CODE"] = objProject.ProjectCode.ToString();
            }
            txtpercentage.Text  = Convert.ToString(objProject.PercentageofPAP);
            txtProjectCode.Text = objProject.ProjectCode;
            Master.PageHeader   = objProject.ProjectCode + " - Project Details";

            txtProjectName.Text = objProject.ProjectName;
            txtObjective.Text   = objProject.Objective;

            if (objProject.ProjectStartDate != DateTime.MinValue)
            {
                dpProjectStartDate.Text = Convert.ToString(objProject.ProjectStartDate.ToString(UtilBO.DateFormat));
            }

            if (objProject.ProjectEndDate != DateTime.MinValue)
            {
                dpProjectEndDate.Text = Convert.ToString(objProject.ProjectEndDate.ToString(UtilBO.DateFormat));
            }

            txtTotalEstBudget.Text = UtilBO.CurrencyFormat(objProject.TotalEstBudget);
            txtLabouCost.Text      = UtilBO.CurrencyFormat(objProject.Labourcost);
            txtBulMatCost.Text     = UtilBO.CurrencyFormat(objProject.BUILDINGMATCOST);
            txtDollervalue.Text    = Convert.ToString(objProject.Dollervalue);
            //String.Format("{0:C0}", objProject.TotalEstBudget).Replace("$", "");

            LoadCurrencyTotalEstimate();
            ddlCurrencyTypeTotalEstBudget.ClearSelection();
            if (ddlCurrencyTypeTotalEstBudget.Items.FindByValue(objProject.BudgetCurrency.ToString()) != null)
            {
                ddlCurrencyTypeTotalEstBudget.Items.FindByValue(objProject.BudgetCurrency.ToString()).Selected = true;
            }

            ViewState["BudgetCurrency"] = objProject.BudgetCurrency;

            //LoadCurrencyEstimate();
            //ddlCurrencyTypeEstBudget.ClearSelection();
            //if (ddlCurrencyTypeEstBudget.Items.FindByValue(objProject.BudgetCurrency.ToString()) != null)
            //{
            //    ddlCurrencyTypeEstBudget.Items.FindByValue(objProject.BudgetCurrency.ToString()).Selected = true;
            //}
            //ddlCurrencyTypeEstBudget.Enabled = false;
            DisplayEstBudget();

            ddlProjectStatus.ClearSelection();

            if (ddlProjectStatus.Items.FindByValue(objProject.ProjectStatus.ToUpper()) != null)
            {
                ddlProjectStatus.Items.FindByValue(objProject.ProjectStatus.ToUpper()).Selected = true;
            }
            //Loading Segments
            if (Session["PROJECT_ID"] != null)
            {
                int ProjectId = Convert.ToInt32(Session["PROJECT_ID"]);
                LoadProjectSegmentGV(ProjectId);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 主作业计划通用分页查询,view=Projectgrid,
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPageProjectInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "FPlanCommitDate" : Request["sort"];
            string order    = Request["order"] == null ? "desc" : Request["order"];
            string view     = Request["view"] == null ? "" : Request["view"];

            //首先获取前台传递过来的参数
            int    pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);  //输出的数据页码
            int    pagesize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]); //每页输出数量
            string FBillNo   = Request["FBillNo"] == null ? "" : Request["FBillNo"];
            string FName     = Request["FName"] == null ? "" : Request["FName"];
            //string isable = Request["isable"] == null ? "" : Request["isable"];
            string FModel          = Request["FModel"] == null ? "" : Request["FModel"];
            string FStatus         = Request["FStatus"] == null ? "" : Request["FStatus"];
            string FPlanCommitDate = Request["FPlanCommitDate"] == null ? "" : Request["FPlanCommitDate"];

            if (FBillNo.Trim() != "" && !SqlInjection.GetString(FBillNo))   //防止sql注入
            {
                strWhere += string.Format(" and FBillNo like '%{0}%'", FBillNo.Trim());
            }

            if (FName.Trim() != "" && !SqlInjection.GetString(FName))   //防止sql注入
            {
                strWhere += string.Format(" and FName like '%{0}%'", FName.Trim());
            }

            if (FModel.Trim() != "" && !SqlInjection.GetString(FModel))   //防止sql注入
            {
                strWhere += string.Format(" and FModel like '%{0}%'", FModel.Trim());
            }

            if (FStatus == "true")
            {
                strWhere += string.Format(" and FStatus > 2 ");
            }
            else
            {
                strWhere += string.Format(" and FStatus < 3 ");
            }


            if (FPlanCommitDate.Trim() != "")
            {
                strWhere += " and FPlanCommitDate > '" + FPlanCommitDate.Trim() + "'";
            }

            //抽取主作业计划单,规则不包含-、_两种连接符
            strWhere += " and Fbillno not like '%v_%'  ESCAPE   'v'  and  Fbillno not like '%v-%' ESCAPE   'v'";

            string content = "";

            if (view == "ProjectGrid")
            {
                int totalCount;   //输出参数
                //string strJson = new ProjectBLL().GetJsonPager("ICMO", "FBillNo,FStatus,FQty,FCommitQty,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FType,FWorkShop,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                string strJson = new ProjectBLL().GetJsonPager((pageindex - 1) * pagesize + 1, pageindex * pagesize, strWhere, out totalCount);
                content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }
            if (view == "ProjectGantt")
            {
                int totalCount;   //输出参数
                // pagesize = 5;//限制甘特图输出数据量
                DataTable dt      = new ProjectBLL().GetDataTablePager("ICMO", "FBillNo,FStatus,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                string    strJson = ToGanttJson(dt);
                content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }

            return(Content(content));
        }
Esempio n. 5
0
    public static object SetPerimeterFromSIP(string projectID, string JStr, string userID)
    {
        Project project = new ProjectBLL().GetProjectByProjectId2(Convert.ToInt32(projectID));

        using (DatabaseContext _DatabaseContext = new DatabaseContext())
        {
            var nList = new JavaScriptSerializer().Deserialize <Object>(JStr);

            ProjectInfoTreeLocation projectInfoTreeLocation = project.ProjectInfoTreeLocations.Count == 0 ? new ProjectInfoTreeLocation() : _DatabaseContext.ProjectInfoTreeLocations.First(instance => instance.ProjectID == project.ProjectID);
            projectInfoTreeLocation.X = ((Dictionary <string, object>)nList).ContainsKey("X") ? Convert.ToDecimal(((Dictionary <string, object>)nList)["X"]) : projectInfoTreeLocation.X;
            projectInfoTreeLocation.Y = ((Dictionary <string, object>)nList).ContainsKey("Y") ? Convert.ToDecimal(((Dictionary <string, object>)nList)["Y"]) : projectInfoTreeLocation.Y;

            string url =
                "http://www.gis.sip.pr.gov/ArcGIS/rest/services/Tools/Localizdor_JS8/MapServer/identify?f=json&geometry=%7B%22" +
                "x%22%3A" + miX + "%2C%22" +
                "y%22%3A" + miY + "%2C%22" +
                "spatialReference%22%3A%7B%22wkid%22%3A32161%7D%7D&tolerance=1&returnGeometry=true&mapExtent=%7B%22" +
                "xmin%22%3A" + miX + "%2C%22" +
                "ymin%22%3A" + miY + "%2C%22" +
                "xmax%22%3A" + miX + "%2C%22" +
                "ymax%22%3A" + miY + "%2C%22" +
                "spatialReference%22%3A%7B%22wkid%22%3A32161%7D%7D&imageDisplay=1920%2C304%2C96&geometryType=esriGeometryPoint&sr=32161&layers=all%3A0&callback=dojo.io.script.jsonp_dojoIoScript6._jsonpCallback";

            var json = new WebClient().DownloadString(url);

            var points = new JavaScriptSerializer().Deserialize <Object>(json.Replace("dojo.io.script.jsonp_dojoIoScript6._jsonpCallback(", "").Replace(");", ""));

            JObject j      = JObject.FromObject(points);
            JArray  jArray = GetRings(j);

            Perimeter mainPerimeter = _DatabaseContext.Perimeters.FirstOrDefault(instance => instance.IsMainPerimeter);
            if (mainPerimeter != null)
            {
                mainPerimeter.IsMainPerimeter = false;
                mainPerimeter.PerimeterName   = "Perímetro";

                // Foreign Key Color
                Color blue = _DatabaseContext.Colors.First(instance => instance.ColorID == 1);
                mainPerimeter.ColorID = blue.ColorID;
                mainPerimeter.ColorReference.EntityKey = blue.EntityKey;
                //
            }

            Perimeter newPerimeter = new Perimeter();

            List <PerimeterPoint> perimeterPoints        = new List <PerimeterPoint>();
            List <object>         perimeterPointsObjects = new List <object>();

            // Initialize a context
            using (JavascriptContext context = new JavascriptContext())
            {
                System.Collections.Generic.Dictionary <string, object> anewpointObj = new Dictionary <string, object>();
                using (var streamReader = new StreamReader(new Page().Server.MapPath(@"~/App_Resources\client-scripts\tl\proj4js-compressed.js")))
                {
                    context.Run(streamReader.ReadToEnd() + ScriptFileSeparator);
                }

                foreach (JToken JToken1 in jArray)
                {
                    foreach (JToken JToken2 in JToken1)
                    {
                        // Script
                        string script = @"
                                            function ConvertToLatLng(x, y) {
                                                Proj4js.defs[""EPSG:32161""] = ""+proj=lcc +lat_1=18.43333333333333 +lat_2=18.03333333333333 +lat_0=17.83333333333333 +lon_0=-66.43333333333334 +x_0=200000 +y_0=200000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"";
                                                Proj4js.defs[""EPSG:4326""] = ""+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"";
                                                var source = new Proj4js.Proj('EPSG:32161');
                                                var dest = new Proj4js.Proj('EPSG:4326');
                                                var anewpoint = new Proj4js.Point(x, y);
                                                Proj4js.transform(source, dest, anewpoint);
                                                return anewpoint;
                                            }

                                           var anewpoint = ConvertToLatLng(parseFloat('" + ((JValue)(JToken2[0])).Value.ToString() + "'),parseFloat('" + ((JValue)(JToken2[1])).Value.ToString() + "')); ";

                        // Running the script
                        context.Run(script);

                        // Getting a parameter
                        anewpointObj = (System.Collections.Generic.Dictionary <string, object>)context.GetParameter("anewpoint");

                        PerimeterPoint perimeterPoint = new PerimeterPoint();

                        perimeterPoint.Y = Convert.ToDecimal(anewpointObj["y"]);
                        perimeterPoint.X = Convert.ToDecimal(anewpointObj["x"]);

                        perimeterPoint.PerimeterID = newPerimeter.PerimeterID;
                        perimeterPoint.PerimeterReference.EntityKey = newPerimeter.EntityKey;

                        newPerimeter.PerimeterPoints.Add(perimeterPoint);

                        var perimeterPointObject = new
                        {
                            perimeterPoint.PerimeterID,
                            perimeterPoint.PerimeterPointID,
                            perimeterPoint.X,
                            perimeterPoint.Y
                        };
                        perimeterPointsObjects.Add(perimeterPointObject);
                    }
                }
            }

            newPerimeter.IsMainPerimeter = true;
            newPerimeter.PerimeterName   = "Perímetro Principal";

            newPerimeter.CreatedDate   = DateTime.Now;
            newPerimeter.CreatorUserID = new Guid(userID);
            newPerimeter.EditedDate    = DateTime.Now;
            newPerimeter.EditorUserID  = new Guid(userID);


            // Foreign Key Project
            newPerimeter.ProjectID = project.ProjectID;
            newPerimeter.ProjectReference.EntityKey = project.EntityKey;
            //

            // Foreign Key Color
            Color red = _DatabaseContext.Colors.First(instance => instance.ColorID == 2);
            newPerimeter.ColorID = red.ColorID;
            newPerimeter.ColorReference.EntityKey = red.EntityKey;
            //

            _DatabaseContext.Perimeters.AddObject(newPerimeter);

            _DatabaseContext.SaveChanges();

            var perimeterObject = new
            {
                newPerimeter.ColorID,
                newPerimeter.Color.Code,
                newPerimeter.Color.ColorDesc,
                newPerimeter.IsMainPerimeter,
                newPerimeter.PerimeterID,
                newPerimeter.PerimeterName,
                PerimeterPoints = perimeterPointsObjects,
                newPerimeter.ProjectID
            };

            return(perimeterObject);
        }
    }
        public IHttpActionResult Get(int id)
        {
            ProjectBLL projectBLL = new ProjectBLL();

            return(Ok(projectBLL.Get(id)));
        }
 public ProjectListForm()
 {
     InitializeComponent();
     _proBLL  = new ProjectBLL();
     _workBLL = new WorkBLL();
 }
Esempio n. 8
0
        protected bool GetData()
        {
            UserBLL userbll = new UserBLL();

            //获取项目信息
            model = bll.GetProjectDetailInfo(projectId.Value);
            if (model == null)
            {
                Response.Redirect(GlobalUtils.WebURL + "/Member/my_account.aspx");
                return(false);
            }

            ProjectXMBBLL xbmbll = new ProjectXMBBLL();

            if (this.model.Type == 23)
            {
                rateRangeList = xbmbll.GetXMBRateContrastInfo(projectId.Value);
            }

            this.SubscribeUserCount = TuanDai.WXApiWeb.Common.WXInvest.WXGetSubscribeUserCount(this.projectId.Value);
            borrowerUserInfo        = userbll.GetUserBasicInfoModelById(model.UserId.Value);

            #region 获取担保公司
            UserEnterpriseInfo userEnterprise = GetBorrowerGuaranteeEnterprise(this.model.UserId.Value, model.AddDate.Value);
            if (userEnterprise != null)
            {
                string            sql  = "select NickName from UserBasicInfo with(nolock) where id=@enterpriseuserid";
                DynamicParameters args = new DynamicParameters();
                args.Add("@enterpriseuserid", userEnterprise.UserId);
                this.EnterpriseName = PublicConn.QuerySingle <string>(sql, ref args);
            }
            else
            {
                if (model.Guarantors != null && model.Guarantors != "")
                {
                    this.EnterpriseName = BusinessDll.business.GetAssureNameById(int.Parse(model.Guarantors.ToString()));
                }
            }
            #endregion

            ProjectBLL projbll = new ProjectBLL();
            xmbModel = projbll.GetProjectXMBInfo(projectId.Value);
            if (xmbModel == null)
            {
                xmbModel = new Project_XMB_Info();
            }
            allMonthBadrate = calcrate(model.TotalSumShares ?? 0, model.badShares ?? 0);
            IsSMBGuQuan     = xmbModel.Type == 1;

            //modify by shellben 2015-12-29 处理元旦活动加息,以下是规则
            //2015-12-29 00:00至2016-1-25 24:00期间加息标的仅含“小微企业”“微团贷”“项目宝B”
            //加息幅度根据期限适配:
            //1-5个月:+1%
            //6-11个月:+1.5%
            //12个月及以上:+2%
            if (DateTime.Now >= DateTime.Parse("2015/12/29 00:00:00") &&
                DateTime.Now < DateTime.Parse("2016/1/26 00:00:00"))
            {
                if (new int[] { 1, 3, 9, 10, 11, 22 }.Contains(model.Type ?? 0) && (model.TuandaiRate ?? 0) <= 0)
                {
                    if (model.Deadline <= 5)
                    {
                        model.TuandaiRate = 1;
                    }
                    else if (model.Deadline >= 12)
                    {
                        model.TuandaiRate = 2;
                    }
                    else
                    {
                        model.TuandaiRate = 1.5;
                    }
                }
            }

            return(true);
        }
Esempio n. 9
0
 private void button20_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     //bll.FinanceConfirm("3ed1b947f1d9401fa1b799a802d9d00a", "14", null, null, null, null, null, null, null);
 }
Esempio n. 10
0
        private void button10_Click(object sender, EventArgs e)
        {
            Workflow wf = new Workflow();
            string userid = "9";
            //ProjectBLL bll = new ProjectBLL();
            //bll.Add(new Project
            //{
            //    Creator = "9",
            //    Name = "test",
            //}, new List<Asset>(), new List<Customer_Project>(), new List<Customer>(), new List<Guarantor>(), "9"

            //);
            //处理流程
            ProjectBLL bll = new ProjectBLL();
            bll.Save(new Project
            {
                ID = "111",
            }, new List<Asset>
            {
                new Asset
                {
                    Code = "test",
                    Address = "test",
                    Joint = new List<Joint> {
                        new Joint { Name="test1", JointType = 1 }
                    },
                    Remark = "hello"
                }
            }, new List<Customer>
            {
                new Customer
                {
                    Name = "test3",
                    Remark = "world",
                    Gender = 2,
                }
            }, new List<Customer>
            {
                new Customer
                {
                    Name = "test4",
                    Remark = "yes",
                    Gender = 2,
                }
            }, null, null, null, "1");

            //WorkflowDefinitionModel wfdm = WorkflowDefinitionModel.LoadByName("额度申请");
            //var workflow = wfdm.StartNew(userid, "", new WorkflowAuthority());
            ////如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
            //var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
            //if (task != null)
            //{
            //    workflow.ProcessActivity(new Approval
            //    {
            //        Creator = userid,
            //        LastUpdator = userid,
            //        Remark = "test",
            //        Status = (int)ApprovalStatus.Agree,
            //        ActivityID = workflow.CurrentActivity.Value.ID,
            //        WorkflowID = workflow.Value.ID,
            //    }, userid, new WorkflowAuthority());
            //}
        }
Esempio n. 11
0
 private void button18_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     bll.UpdateFinance("a074c5e65c96481db5af54dfd4f75f86", new Project
     {
         RefundAccount = "1",
         RefundBankName = "11",
         RefundDate = DateTime.Now,
         RefundMoney = 1,
         RefundName = "111",
         PaymentName = "2",
         PaymentAccount = "22",
         PaymentBankName = "222",
         PaymentDate = DateTime.Now,
         PaymentMoney = 2,
         ID = textBox1.Text,
     }, "14");
 }
Esempio n. 12
0
 private void button17_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     bll.UpdateTracking(new UpdateTrackingServiceForm
     {
         LastUpdator = "7",
         ChangeOwnerRemark = "",
         MortgageRemark = "",
         NewAssetDate = new DateTime(2016, 1, 4),
         LogoutAssetTime = new DateTime(2016, 1, 4),
         ChangeOwnerProfileTime = new DateTime(2016, 1, 5),
         ChangeOwnerProfileCode = "9C-416001002",
         ID = textBox1.Text,
     }, "30590d6bcda743f9a4490e73b9d92fb3", "7");
 }
Esempio n. 13
0
 private void button15_Click(object sender, EventArgs e)
 {
     ProjectBLL bll = new ProjectBLL();
     var a = bll.QueryDetail(textBox1.Text, "", "14");
 }
Esempio n. 14
0
        /// <summary>
        /// 获取我的借款记录列表
        /// </summary>
        public void GetMyLoanShowList()
        {
            int    pagesize  = GlobalUtils.PageSize;
            int    pageindex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1);
            int    status    = Tool.SafeConvert.ToInt32(Context.Request.Form["statusStr"], 0);
            string userId    = Tool.SafeConvert.ToString(Context.Request.Form["userId"]);
            Guid   uId       = WebUserAuth.UserId.Value;

            if (uId == Guid.Empty)
            {
                if (string.IsNullOrEmpty(userId))
                {
                    uId = Guid.NewGuid();
                }
                else
                {
                    uId = Guid.Parse(userId);
                }
            }
            if (pageindex < 1)
            {
                pageindex = 1;
            }

            StringBuilder     sb          = new StringBuilder();
            int               totalcount  = 0;
            ProjectBLL        bll         = new ProjectBLL();
            WXMyLoanList_Info myLoanModel = bll.WXGetMyLoanList(uId, status, pageindex, pagesize, out totalcount);

            if (myLoanModel != null && myLoanModel.List.Count() > 0)
            {
                int index     = 1;
                int pageCount = GetPageCount(totalcount, pagesize);//总页数

                sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"" + pageCount + "\",\"list\":[");
                foreach (WXSubMyLoanList_Info temp in myLoanModel.List)
                {
                    sb.Append("{\"Id\":\"" + temp.ProjectId + "\",\"Title\":\"" + temp.Title + "\",\"ProjectType\":\"" + ToolStatus.ConvertProjectType(temp.Type)
                              + "\",\"Amount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.Amount) + "\",\"HaveBorrowedAmount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.HaveBorrowedAmount)
                              + "\",\"ProcessStr\":\"" + borrowLog.GetProcessStr(temp) + "\",\"MonthsStr\":\"" + borrowLog.GetMonthsStr(temp)
                              + "\",\"PrincipalInterest\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(myLoanModel.PrincipalInterest)
                              + "\",\"LinkUrl\":\"" + borrowLog.GetLinkUrl(temp)
                              + "\",\"CircleCss\":\"" + borrowLog.GetCircleCss(temp)
                              + "\",\"AddDate\":\"" + Convert.ToDateTime(temp.AddDate).ToString("yyyy-MM-dd")
                              + "\",\"DeadlineStr\":\"" + borrowLog.GetDeadlineStr(temp)
                              + "\",\"InterestRate\":\"" + ToolStatus.DeleteZero(temp.InterestRate));

                    if (index == myLoanModel.List.Count())
                    {
                        sb.Append("\"}]}");
                    }
                    else
                    {
                        sb.Append("\"},");
                    }
                    index++;
                }
            }
            else
            {
                sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"0\"}");
            }
            this.Context.Response.Write(sb.ToString());
            this.Context.Response.End();
        }
Esempio n. 15
0
        public JArray GetList()
        {
            ProjectBLL ProjectBLL = new ProjectBLL();

            return(ProjectBLL.GetTree());
        }
Esempio n. 16
0
    protected void OdsProject_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int integer;
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Project project = new ProjectBLL().GetProjectByProjectID(result);

            UserBLL userBLL = new UserBLL();
            Eisk.BusinessEntities.User user = userBLL.GetUserByUserName((HttpContext.Current.User.Identity).Name);

            if (user != null)
            {
                // ProjectInfoTreeLocation
                TextBox         txtX       = (TextBox)formViewTlProject.FindControl("txtX");
                TextBox         txtY       = (TextBox)formViewTlProject.FindControl("txtY");
                TextBox         txtLat     = (TextBox)formViewTlProject.FindControl("txtLat");
                TextBox         txtLon     = (TextBox)formViewTlProject.FindControl("txtLon");
                TextBox         txtParking = (TextBox)formViewTlProject.FindControl("txtParking");
                RadioButtonList rblCalc    = (RadioButtonList)formViewTlProject.FindControl("rblCalc");
                TextBox         txtAcres   = (TextBox)formViewTlProject.FindControl("txtAcres");
                DropDownList    ddlDistanceBetweenTrees = (DropDownList)formViewTlProject.FindControl("ddlDistanceBetweenTrees");
                TextBox         txtLots0              = (TextBox)formViewTlProject.FindControl("txtLots0");
                TextBox         txtLots1              = (TextBox)formViewTlProject.FindControl("txtLots1");
                TextBox         txtLots2              = (TextBox)formViewTlProject.FindControl("txtLots2");
                TextBox         txtLots3              = (TextBox)formViewTlProject.FindControl("txtLots3");
                RadioButtonList rblSocialInterest     = (RadioButtonList)formViewTlProject.FindControl("rblSocialInterest");
                RadioButtonList rblPreviouslyImpacted = (RadioButtonList)formViewTlProject.FindControl("rblPreviouslyImpacted");

                ProjectInfoTreeLocation projectInfoTreeLocation = new ProjectInfoTreeLocation();
                projectInfoTreeLocation.X                  = Convert.ToDecimal(txtX.Text);
                projectInfoTreeLocation.Y                  = Convert.ToDecimal(txtY.Text);
                projectInfoTreeLocation.Lat                = Convert.ToDecimal(txtLat.Text);
                projectInfoTreeLocation.Lon                = Convert.ToDecimal(txtLon.Text);
                projectInfoTreeLocation.Parkings           = Convert.ToInt32(txtParking.Text);
                projectInfoTreeLocation.Acres              = Convert.ToDecimal(txtAcres.Text);
                projectInfoTreeLocation.SocialInterest     = rblSocialInterest.SelectedValue == "1";
                projectInfoTreeLocation.PreviouslyImpacted = rblPreviouslyImpacted.SelectedValue == "1";

                projectInfoTreeLocation.Mitigation = Convert.ToInt32(rblCalc.SelectedValue);
                if (rblCalc.SelectedValue == "0")
                {
                    projectInfoTreeLocation.Lots0 = projectInfoTreeLocation.Lots1 = projectInfoTreeLocation.Lots2 = projectInfoTreeLocation.Lots3 = 0;
                }
                else
                {
                    projectInfoTreeLocation.Lots0 = Int32.TryParse(txtLots0.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots1 = Int32.TryParse(txtLots1.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots2 = Int32.TryParse(txtLots2.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots3 = Int32.TryParse(txtLots3.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.DistanceBetweenTrees = null;
                }

                projectInfoTreeLocation.ProjectID = project.ProjectID;
                projectInfoTreeLocation.ProjectReference.EntityKey = project.EntityKey;

                new ProjectInfoTreeLocationBLL().CreateNewProjectInfoTreeLocation(projectInfoTreeLocation);
                //
            }

            Response.RedirectToRoute(new { edit_mode = "edit", Project_id = result.ToString() });
        }
    }
Esempio n. 17
0
        public JObject GetProjectInfo(int id)
        {
            ProjectBLL ProjectBLL = new ProjectBLL();

            return(ProjectBLL.GetInfo(id));;
        }
Esempio n. 18
0
 private void button13_Click(object sender, EventArgs e)
 {
     //TaskBLL bll = new TaskBLL();
     //string userid = "10";
     //var response = bll.Query(new QueryMyTaskServiceForm { UserID = userid, Status = (int)TaskProcessStatus.Started });
     ProjectBLL projectbll = new ProjectBLL();
     var list = projectbll.QueryMyApply(new QueryMyApplyServiceForm { Status = 3, PageSize = 10, CurrentIndex = 1 });
     var projectids = (from p in list select p.ID).Distinct().ToList();
 }
Esempio n. 19
0
        public JArray GetAll()
        {
            var projects = new ProjectBLL().GetAll();

            return(JArray.Parse(JsonConvert.SerializeObject(projects)));
        }
        public IHttpActionResult Get()
        {
            ProjectBLL projectBLL = new ProjectBLL();

            return(Ok(projectBLL.GetAll()));
        }
Esempio n. 21
0
    public static void SaveProjectLatLng(int projectid, double lat, double lng)
    {
        ProjectBLL Adapter = new ProjectBLL();

        Adapter.updateLatLng(projectid, lat, lng);
    }
Esempio n. 22
0
        /// <summary>
        /// used to add details and save to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnADDSegment_Click(object sender, EventArgs e)
        {
            //Adding New Segment
            string    message           = string.Empty;
            SegmentBO objProjectSegment = new SegmentBO();

            ProjectBLL oProjectBLL = new ProjectBLL();

            objProjectSegment.SegmentName = txtSegmentName.Text;
            objProjectSegment.RouteLength = Convert.ToDecimal(txtRouteLength.Text).ToString();
            objProjectSegment.LineTypeID  = Convert.ToInt32(ddlTypeLine.SelectedValue);

            if (Session["PROJECT_ID"] != null)
            {
                objProjectSegment.ProjectID = Convert.ToInt32(Session["PROJECT_ID"].ToString());
            }

            objProjectSegment.EstBudget            = Convert.ToDecimal(txtEstBudget.Text);
            objProjectSegment.ImplementationPeriod = txtImplementationPeriod.Text;
            objProjectSegment.ConstrStartDate      = Convert.ToDateTime(dpConstructionStartDate.Text);
            objProjectSegment.ConstrEndDate        = Convert.ToDateTime(dpConstructionEndDate.Text);
            objProjectSegment.Funder       = txtfunder.Text;
            objProjectSegment.Bankid       = Convert.ToInt32(ddlBank.SelectedItem.Value);
            objProjectSegment.Valueofhouse = Convert.ToDecimal(txtValueofhouse.Text);


            objProjectSegment.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
            objProjectSegment.IsDeleted = "False";

            if (ViewStateProjectSegmentId > 0)
            {
                //Updating the Segment
                objProjectSegment.ProjectSegmentID = ViewStateProjectSegmentId;
                message = oProjectBLL.UpdateProjectSegment(objProjectSegment);
                SetUpdateMode(true);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
            }
            else
            {
                //Adding New Segment
                message = oProjectBLL.SaveProjectSegment(objProjectSegment);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                }
            }
            ClearSegment();

            //Loading Segments
            if (Session["PROJECT_ID"] != null)
            {
                int ProjectId = Convert.ToInt32(Session["PROJECT_ID"]);
                LoadProjectSegmentGV(ProjectId);
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("/Member/Repayment/my_return_list.aspx?typeTab=Disperse&tab=CompletedAndFlow", true);
            this.projectId = WEBRequest.GetGuid("id");
            backUrl        = WEBRequest.GetQueryString("backurl");
            if (this.projectId != Guid.Empty)
            {
                string tdfrom     = Request.QueryString["tdfrom"];
                string DOMAINNAME = ConfigurationManager.AppSettings["CookieDomain"];
                //第三方跳投标地址记录来源信
                if (!string.IsNullOrEmpty(tdfrom))
                {
                    if (!string.IsNullOrEmpty(CookieHelper.GetCookie("tdfrom")))
                    {
                        Tool.CookieHelper.ClearCookie("tdfrom");
                    }
                    Tool.CookieHelper.WriteCookie(DOMAINNAME, "tdfrom", tdfrom, 24 * 60 * 7);//保存7天
                }
                string            url         = "";
                ProjectBLL        bll         = new ProjectBLL();
                ProjectDetailInfo projectInfo = bll.GetProjectDetailInfo(projectId.Value);
                if (projectInfo != null)
                {
                    #region
                    switch (projectInfo.Type)
                    {
                    //项目借款
                    case 1:
                    case 3:
                    {
                        url = string.Format("/pages/invest/invest_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    //净股
                    case 6:
                    case 7:
                    {
                        url = string.Format("/pages/invest/jing_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    //微团贷
                    case 9:
                    case 10:
                    case 11:
                    case 34:    //新房贷
                    case 200:
                    case 26:
                    case 40:    //一点车贷
                    {
                        url = string.Format("/pages/invest/mini_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    //团贷宝
                    case 5:
                    {
                        url = string.Format("/pages/invest/bao_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 12:
                    {
                        url = string.Format("/pages/invest/fangbaobao_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 15:
                    {
                        //当为分期宝时
                        WXFQUserApplyInfo FQUserApplyInfo = null;
                        if (projectInfo != null && (projectInfo.Type ?? 0) == 15)
                        {
                            FQUserApplyInfo = bll.WXGetFQUserApplyInfo(projectId.Value.ToString());
                        }

                        if (FQUserApplyInfo.OrgTypeId != null && FQUserApplyInfo.OrgTypeId != 5)
                        {
                            url = string.Format("/pages/invest/fqbao_detail.aspx?projectid={0}", this.projectId);
                        }
                        else
                        {
                            url = string.Format("/pages/invest/fqle_detail.aspx?projectid={0}", this.projectId);
                        }
                        break;
                    }

                    case 16:
                    case 17:
                    {
                        url = string.Format("/pages/invest/bond_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 18:
                    {
                        url = string.Format("/pages/invest/simubao_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 19:
                    {
                        url = string.Format("/pages/invest/gylds_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 20:     //供应链标
                    {
                        url = string.Format("/pages/invest/gyl_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 22:
                    case 23:
                    {
                        url = string.Format("/pages/invest/xmb_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }

                    case 24:    //消费金融
                    case 25:    //正合小贷业务
                    case 42:
                        url = string.Format("/pages/invest/puhui_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 27:    //你我金融----话费分期
                        url = string.Format("/pages/invest/huafei_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 28:    //快来贷
                        url = string.Format("/pages/invest/kuailaidai_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 29:    //沐金农
                        url = string.Format("/pages/invest/mjn_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 30:    //极速借
                        url = string.Format("/pages/invest/jisujie_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 32:    //有信贷
                        url = string.Format("/pages/invest/youxindai_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 36:    //农饲贷
                        url = string.Format("/pages/invest/nsd_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 39:    //车全
                        url = string.Format("/pages/invest/chequan_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 41:    //二手车商
                        url = string.Format("/pages/invest/twocar_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 48:    //扶贫贷
                        url = string.Format("/pages/invest/fupin_detail.aspx?projectid={0}", this.projectId);
                        break;

                    case 31:    //拿下分期标
                    case 46:    //
                    case 45:    //
                    case 44:
                    case 43:
                    case 35:
                    case 33:
                        url = "/pages/invest/invest_list.aspx?v=20171216";
                        break;

                    default:
                        url = string.Format("/pages/invest/invest_detail.aspx?projectid={0}", this.projectId);
                        break;
                    }
                    #endregion
                }
                else
                {
                    //债权转证
                    ProjectZQZRDetailInfo model = new SubScriberansferBLL().GetSubScriberansfer(projectId.Value);
                    if (model != null)
                    {
                        url = string.Format("/pages/invest/zqzr_detail.aspx?projectid={0}", this.projectId);
                    }
                }
                if (url != "")
                {
                    url += "&backurl=" + backUrl.Replace(" ", "+");
                }
                Response.Redirect(GlobalUtils.MTuanDaiURL + url);
            }
            else
            {
                Response.Redirect(GlobalUtils.WebURL);
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Used to save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                ProjectBO objProject = new ProjectBO();
                objProject.PercentageofPAP = Convert.ToDecimal(txtpercentage.Text.Trim());
                objProject.ProjectCode     = txtProjectCode.Text.Trim();
                objProject.ProjectName     = txtProjectName.Text.Trim();

                string sObj = txtObjective.Text.Trim();
                if (sObj.Trim().Length > 1000)
                {
                    sObj = sObj.Substring(0, 1000);
                }
                objProject.Objective = sObj.Trim();

                if (dpProjectStartDate.Text.Trim() != "")
                {
                    objProject.ProjectStartDate = Convert.ToDateTime(dpProjectStartDate.Text.ToString());
                }

                if (dpProjectEndDate.Text.Trim() != "")
                {
                    objProject.ProjectEndDate = Convert.ToDateTime(dpProjectEndDate.Text.ToString());
                }

                objProject.BudgetCurrency = Convert.ToInt32(ddlCurrencyTypeTotalEstBudget.SelectedValue);

                if (txtTotalEstBudget.Text.Trim().Length > 0)
                {
                    objProject.TotalEstBudget = Convert.ToDecimal(txtTotalEstBudget.Text.Trim());
                }
                if (txtLabouCost.Text.Trim().Length > 0)
                {
                    objProject.Labourcost = Convert.ToDecimal(txtLabouCost.Text);
                }
                if (txtBulMatCost.Text.Trim().Length > 0)
                {
                    objProject.BUILDINGMATCOST = Convert.ToDecimal(txtBulMatCost.Text);
                }
                if (txtDollervalue.Text.Trim().Length > 0)
                {
                    objProject.Dollervalue = Convert.ToDecimal(txtDollervalue.Text);
                }
                if (ddlProjectStatus.SelectedIndex > 0)
                {
                    objProject.ProjectStatus = ddlProjectStatus.SelectedItem.Value;
                }
                else
                {
                    ddlProjectStatus.ClearSelection();
                    ddlProjectStatus.SelectedIndex = 1;
                    objProject.ProjectStatus       = ddlProjectStatus.SelectedItem.Value;
                }

                if (Session["PROJECT_ID"] != null)
                {
                    objProject.ProjectID = Convert.ToInt32(Session["PROJECT_ID"]);
                    objProject.UpdatedBy = (int)Session["USER_ID"];
                }
                else
                {
                    objProject.CreatedBy = (int)Session["USER_ID"];
                }

                ProjectBLL objProjectBLL = new ProjectBLL();

                if (Session["PROJECT_ID"] != null)
                {
                    string msg = objProjectBLL.UpdateProject(objProject);
                    if (msg == "")
                    {
                        msg = "Data updated successfully.";
                    }
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + msg + "');", true);
                    ViewState["BudgetCurrency"] = ddlCurrencyTypeTotalEstBudget.SelectedValue;

                    if (txtTotalEstBudget.Text.Trim().Length > 0)
                    {
                        txtTotalEstBudget.Text = UtilBO.CurrencyFormat(Convert.ToDecimal(txtTotalEstBudget.Text));
                    }

                    DisplayEstBudget();
                }
                else
                {
                    string[] result  = objProjectBLL.AddProject(objProject);
                    string   message = "";

                    if (string.IsNullOrEmpty(result[1]) || result[1] == "" || result[1] == "null")
                    {
                        Session["PROJECT_ID"]   = result[0];
                        Session["PROJECT_CODE"] = objProject.ProjectCode;
                        Session["FROZEN"]       = "N";

                        message = "alert('Data saved successfully');location.href='ProjectRoute.aspx';";
                    }
                    else
                    {
                        message = result[1];
                        message = "alert('" + message + "');";
                    }

                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", message, true);
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 定时器事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                ////员工编号
                //string employeeNo = ConfigurationManager.AppSettings["employeeNo"];
                ////循环执行,taskType参数分别为0和1
                //for (int i = 0; i < 2; i++)
                //{
                //    object[] arg = { (object)"{\"userNo\":\"" + employeeNo + "\",\"taskType\":\"" + i + "\"}" };
                //    InvokeWebService(arg, i.ToString());
                //}

                //需提醒的任务列表DataSet
                DataSet dsRmd = trBll.GetList("ISREMINDED = 0 AND DATE_SUB(CURDATE(), INTERVAL 100 DAY) <= date(CREATEDATE)");
                if (dsRmd != null && dsRmd.Tables.Count > 0 && dsRmd.Tables[0].Rows.Count > 0)
                {
                    //需要提醒的任务DataTable
                    DataTable     dtRmd     = dsRmd.Tables[0];
                    StringBuilder sbTaskNos = new StringBuilder("'',");
                    //遍历去除需要提醒的任务的编号
                    for (int i = 0; i < dtRmd.Rows.Count; i++)
                    {
                        sbTaskNos.AppendFormat("'{0}',", dtRmd.Rows[i]["FOLDER"]);
                    }
                    //LogHelper.WriteLine("需要提醒的任务:" + sbTaskNos);
                    ProjectBLL pBll = new ProjectBLL();
                    //根据任务编号获取相应的任务列表
                    DataSet dsProject = pBll.GetListSimpleUnion(string.Format(" AND TASKNO IN ({0})", sbTaskNos.ToString().TrimEnd(',')));
                    if (dsProject == null || dsProject.Tables.Count == 0 || dsProject.Tables[0].Rows.Count == 0)
                    {
                        return;
                    }
                    DataTable dtProject = dsProject.Tables[0];

                    DataSet dsEmp = eBll.GetList(string.Empty, "EMPLOYEENO");
                    //获取所有员工列表
                    DataTable dtEmployees = dsEmp.Tables[0];

                    //需要抄送的员工的钉钉UserId
                    string externalDingdingUserId = Convert.ToString(ConfigurationManager.AppSettings["externalDingdingUserId"]);
                    // 任务详细页面地址
                    string taskDetailsPageUrl = Convert.ToString(ConfigurationManager.AppSettings["taskDetailsPageUrl"]);

                    //遍历员工列表
                    for (int i = 0; i < dtEmployees.Rows.Count; i++)
                    {
                        //用户ID
                        string userId = dtEmployees.Rows[i]["ID"].ToString();
                        //用户在钉钉系统中的UserId
                        string dingtalkUserId = dtEmployees.Rows[i]["DINGTALKUSERID"].ToString();
                        //钉钉UserId为空,就没有继续执行的必要了,直接执行下一个员工
                        if (string.IsNullOrEmpty(dingtalkUserId))
                        {
                            continue;
                        }
                        //员工编号
                        string empNo = dtEmployees.Rows[i]["EMPLOYEENO"].ToString();
                        //用户类型
                        string userType = dtEmployees.Rows[i]["TYPE"].ToString();// ConfigurationManager.AppSettings["userType"];
                        //筛选条件
                        string strDtRmdSelect = string.Empty;
                        //用户类型为1,是客服,当时插入数据时录入的是员工ID
                        if (userType == "1")
                        {
                            strDtRmdSelect = string.Format(" enteringPerson = '{0}' AND TOUSERTYPE = '{1}'", userId, userType);
                        }
                        //用户类型为2,是造价员,当时插入数据时录入的是员工编号
                        else if (userType == "2")
                        {
                            strDtRmdSelect = string.Format(" employeeNo = '{0}' AND TOUSERTYPE = '{1}'", empNo, userType);
                        }
                        //用户类型为0,是针对管理员进行的提醒
                        else if (userType == "0")
                        {
                            strDtRmdSelect = string.Format(" TOUSERTYPE = '{0}'", userType);
                        }
                        //客服和造价员均不是,就不提醒了
                        else
                        {
                            continue;
                        }
                        DataRow[] drRmd = dtRmd.Select(strDtRmdSelect);
                        //对任务提醒列表进行遍历
                        for (int drEmpRmdIndex = 0 /*针对某个员工的提醒索引*/; drEmpRmdIndex < drRmd.Length; drEmpRmdIndex++)
                        {
                            string taskType = drRmd[drEmpRmdIndex]["taskType"].ToString();
                            //提醒消息文本
                            string    remindMsg     = string.Empty;
                            string    taskNo        = drRmd[drEmpRmdIndex]["folder"].ToString();
                            string    finishedEmpNo = drRmd[drEmpRmdIndex]["EMPLOYEENO"].ToString();
                            string    kefuEmpId     = Convert.ToString(drRmd[drEmpRmdIndex]["ENTERINGPERSON"]);
                            string    wangwangName  = string.Empty;
                            string    shopName      = string.Empty;
                            string    projectId     = string.Empty;
                            DataRow[] drProject     = dtProject.Select(string.Format(" TASKNO = '{0}'", taskNo));
                            if (drProject.Length > 0)
                            {
                                wangwangName = drProject[0]["wangwangName"].ToString();
                                shopName     = drProject[0]["shop"].ToString();
                                projectId    = drProject[0]["ID"].ToString();
                            }
                            drProject = null;

                            //客服。如果是客服的话,是收不到任务类型为2(即任务倒计时)提醒的。虽然在数据插入时已基本杜绝这种条件同时成立,但这里还是在条件中限制一下。
                            if (userType == "1" && taskType != "2")
                            {
                                // 客服需接收的提醒类型有:普通任务的完成提醒、售后修改任务的完成提醒、新的疑问提醒和疑问答复提醒共 4 种
                                //普通任务
                                if (taskType == "0")
                                {
                                    remindMsg = string.Format("{0}\n完成人:{1}\n客户ID:{2}\nStore ID:{3}",
                                                              taskNo, finishedEmpNo, wangwangName, shopName);
                                }
                                //售后任务
                                else if (taskType == "1")
                                {
                                    string modifyFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg = string.Format("{0}的{1}\n完成人:{2}\n客户ID:{3}\nStore ID:{4}",
                                                              taskNo, modifyFolder, finishedEmpNo, wangwangName, shopName);
                                }
                                // 新的疑问
                                else if (taskType == "4")
                                {
                                    string questionFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg = string.Format("【新疑问】\n任务:{0}的{1}\n提问人:客服",
                                                              taskNo, questionFolder);
                                }
                                // 疑问答复
                                else if (taskType == "5")
                                {
                                    string questionFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg = string.Format("【新答复】\n任务:{0}的{1}\n答复人:{2}",
                                                              taskNo, questionFolder, finishedEmpNo);
                                }
                                //客服和造价员均不是,就不提醒了
                                else
                                {
                                    continue;
                                }
                                // 在这里,录入一条动态到客服的动态列表中
                                try
                                {
                                    if (!string.IsNullOrEmpty(remindMsg))
                                    {
                                        TaskTrendBLL ttBll = new TaskTrendBLL();
                                        TaskTrend    trend = new TaskTrend();
                                        trend.ID          = Guid.NewGuid().ToString();
                                        trend.PROJECTID   = ttBll.GetProjectIDByTaskNo(taskNo);
                                        trend.EMPLOYEEID  = kefuEmpId;// ttBll.GetEmployeeIDByEmployeeNo(empNo);
                                        trend.DESCRIPTION = remindMsg;
                                        trend.CREATEDATE  = DateTime.Now;
                                        trend.READSTATUS  = false;
                                        // 客服类型
                                        trend.TYPE = 2;
                                        ttBll.Add(trend);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.WriteLine("添加任务" + taskNo + "动态失败:" + ex.Message + ex.StackTrace);
                                }
                            }
                            //员工(造价员)
                            else if (userType == "2")
                            {
                                //LogHelper.Write("工程师");
                                // 工程师需接收的提醒有:普通任务(即新任务)提醒、售后任务(即新的修改)提醒、新的疑问和疑问答复共 4 种
                                string taskTrendMsg = string.Empty;
                                //普通任务
                                if (taskType == "0")
                                {
                                    remindMsg    = string.Format("【新任务提醒】\r\n{0},您有一个新任务:{1}", empNo, taskNo);
                                    taskTrendMsg = string.Format("【新任务】{0}", taskNo);
                                }
                                //售后任务
                                else if (taskType == "1")
                                {
                                    string modifyFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg    = string.Format("【修改任务提醒】\r\n{0},您有一个新的修改任务:{1}的{2}", empNo, taskNo, modifyFolder);
                                    taskTrendMsg = string.Format("【新修改任务】{0}的{1}", taskNo, modifyFolder);
                                    if (!string.IsNullOrEmpty(Convert.ToString(drRmd[drEmpRmdIndex]["SENTCOUNT"])))
                                    {
                                        int sentCount = Convert.ToInt32(drRmd[drEmpRmdIndex]["SENTCOUNT"]);
                                        if (sentCount > 0)
                                        {
                                            remindMsg    += string.Format("(客服{0}次提醒)", sentCount);
                                            taskTrendMsg += string.Format("(客服{0}次提醒)", sentCount);
                                        }
                                    }
                                }
                                else if (taskType == "2")
                                {
                                    remindMsg    = string.Format("【任务预警】\r\n{0},任务{1}距交稿时间已不足3小时", empNo, taskNo);
                                    taskTrendMsg = string.Format("【任务预警】任务{0}仅剩3小时", taskNo);
                                }
                                // 新的疑问
                                else if (taskType == "4")
                                {
                                    string questionFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg = string.Format("【新疑问提醒】\r\n任务:{0}的{1}\r\n提问人:{2}",
                                                              taskNo, questionFolder, finishedEmpNo);
                                    taskTrendMsg = string.Format("【新疑问】任务{0}的{1}", taskNo, questionFolder);
                                }
                                // 疑问答复
                                else if (taskType == "5")
                                {
                                    string questionFolder = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg = string.Format("【新的疑问答复】\r\n任务:{0}的{1}\r\n答复人:客服",
                                                              taskNo, questionFolder);
                                    taskTrendMsg = $"【疑问答复】任务{taskNo}的{questionFolder}";
                                }
                                // 任务状态变更
                                else if (taskType == "6")
                                {
                                    string taskStatusUpdateMessage = drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString();
                                    remindMsg    = string.Format("【任务状态变更】\n任务{0} {1}", taskNo, taskStatusUpdateMessage);
                                    taskTrendMsg = remindMsg;
                                }
                                else
                                {
                                    continue;
                                }
                                // 在这里,录入一条动态到工程师主页的动态列表中
                                try
                                {
                                    if (!string.IsNullOrEmpty(taskTrendMsg))
                                    {
                                        TaskTrendBLL ttBll = new TaskTrendBLL();
                                        TaskTrend    trend = new TaskTrend();
                                        trend.ID          = Guid.NewGuid().ToString();
                                        trend.PROJECTID   = ttBll.GetProjectIDByTaskNo(taskNo);
                                        trend.EMPLOYEEID  = ttBll.GetEmployeeIDByEmployeeNo(empNo);
                                        trend.DESCRIPTION = taskTrendMsg;
                                        trend.CREATEDATE  = DateTime.Now;
                                        // 工程师类型
                                        trend.TYPE = 1;
                                        ttBll.Add(trend);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.WriteLine("添加任务" + taskNo + "动态失败:" + ex.Message + ex.StackTrace);
                                }
                            }
                            //管理员,只接收任务待分配的提醒
                            else if (userType == "0")
                            {
                                //LogHelper.WriteLine("管理员");
                                // 3 是任务待分配的
                                if (taskType == "3")
                                {
                                    remindMsg = string.Format("【任务待分配提醒】任务{0}待分配", taskNo);
                                }
                                else
                                {
                                    continue;
                                }
                            }

                            #region 调用钉钉接口发送消息
                            //remindMsg = string.Empty;//测试时,置空
                            if (!string.IsNullOrEmpty(remindMsg))
                            {
                                //首先获取accessToken
                                string  accessTokenResult = DingTalkHelper.GetAccessToken();
                                JObject jObj = JObject.Parse(accessTokenResult);
                                //返回码
                                string errcode = jObj["errcode"].ToString();
                                //accessToken
                                string accessToken = string.Empty;
                                //获取成功
                                if (errcode == "0")
                                {
                                    accessToken = jObj["access_token"].ToString();
                                    //发送消息接口的请求地址
                                    string postUrl = string.Format("https://oapi.dingtalk.com/message/send?access_token={0}", accessToken);
                                    //钉钉企业应用id,这个值代表以哪个应用的名义发送消息
                                    string agentid = ConfigurationManager.AppSettings["agentid"];

                                    //定义接收者
                                    string toUser = dingtalkUserId;
                                    //如果额外的接收者不为空
                                    if (!string.IsNullOrEmpty(externalDingdingUserId))
                                    {
                                        toUser += externalDingdingUserId;
                                    }
                                    //如果任务类型为3,说明是新任务待分配提醒
                                    if (taskType == "3")
                                    {
                                        toUser = Convert.ToString(ConfigurationManager.AppSettings["taskAllotmentTipDingdingUserId"]);
                                    }

                                    string param = "";

                                    if (userType == "2" || userType == "0")
                                    {
                                        param = "{\"touser\": \"" + toUser + "\", \"msgtype\": \"text\", \"agentid\": \"" + agentid + "\",\"text\":{" +
                                                "\"content\": \"" + remindMsg + "\"}}";
                                    }
                                    else if (userType == "1")
                                    {
                                        param = "{\"touser\": \"" + toUser + "\", \"msgtype\": \"link\", \"agentid\": \"" + agentid + "\",\"link\":{" +
                                                "\"messageUrl\": \"" + taskDetailsPageUrl + projectId + "\", \"picUrl\":\"@lALOACZwe2Rk\", \"title\":\"提醒\",  \"text\": \"" + remindMsg + "\"}}";
                                    }
                                    LogHelper.WriteLine(param);
                                    //接口返回结果
                                    object msgSendResult = WebServiceHelper.Post(postUrl, param);
                                    //将Object类型结果转换为JObject
                                    JObject jsonSendResult = JObject.Parse(msgSendResult.ToString());
                                    //返回码
                                    errcode = jsonSendResult["errcode"].ToString();
                                    //返回码为0,发送成功
                                    if (errcode == "0")
                                    {
                                        LogHelper.WriteLine("发送至" + empNo + "成功");
                                        string userIdOrEmpNo = string.Empty;
                                        //userType为1,是客服
                                        if (userType == "1")
                                        {
                                            userIdOrEmpNo = userId;
                                        }
                                        //userType为2,是工程师
                                        else if (userType == "2")
                                        {
                                            userIdOrEmpNo = empNo;
                                        }
                                        //将消息置为已读
                                        bool setIsReminded = trBll.SetIsReminding(userIdOrEmpNo, taskNo, drRmd[drEmpRmdIndex]["MODIFYFOLDER"].ToString(), taskType, userType);
                                        if (!setIsReminded)
                                        {
                                            LogHelper.WriteLine("数据库设置消息已读失败,任务编号:" + taskNo);
                                        }
                                    }
                                    else
                                    {
                                        LogHelper.WriteLine("发送至" + empNo + "失败。errcode:" + errcode + ",errmsg:" + jsonSendResult["errmsg"]);
                                    }
                                }
                                else
                                {
                                    string errmsg = jObj["errmsg"].ToString();
                                    LogHelper.WriteLine("access_token获取失败,errmsg:" + errmsg);
                                }
                            }
                            #endregion

                            ////循环执行,taskType参数分别为0、1和2,分别表示普通任务、售后任务和倒计时1小时这三种提醒
                            //for (int j = 0; j < 3; j++)
                            //{
                            //    //拼接参数,用户ID、任务类型和用户类型
                            //    object[] arg = { (object)"{\"userId\":\"" + userId + "\",\"taskType\":\"" + j + "\",\"userType\":\"" + userType + "\"}" };
                            //    if (userType == "0")
                            //    {
                            //        InvokeWebService(arg, j.ToString());
                            //    }
                            //    else if (userType == "1" && j < 2)//i小于2,防止客服也收到倒计时提醒
                            //    {
                            //        InvokeWebServiceCustomerRemind(arg, j.ToString());
                            //    }
                            //}
                        }
                        drRmd = null;
                    }
                    dtEmployees = null;
                    dsEmp       = null;
                    dtProject   = null;
                    dsProject   = null;
                    dtRmd       = null;
                }
                dsRmd = null;

                ////录入人ID
                //string userId = ConfigurationManager.AppSettings["userId"];
                ////用户类型
                //string userType = ConfigurationManager.AppSettings["userType"];
                ////循环执行,taskType参数分别为0、1和2,分别表示普通任务、售后任务和倒计时1小时这三种提醒
                //for (int i = 0; i < 3; i++)
                //{
                //    //拼接参数,用户ID、任务类型和用户类型
                //    object[] arg = { (object)"{\"userId\":\"" + userId + "\",\"taskType\":\"" + i + "\",\"userType\":\"" + userType + "\"}" };
                //    if (userType == "0")
                //    {
                //        InvokeWebService(arg, i.ToString());
                //    }
                //    else if (userType == "1" && i < 2)//i小于2,防止客服也收到倒计时提醒
                //    {
                //        InvokeWebServiceCustomerRemind(arg, i.ToString());
                //    }
                //}
            }
            catch (Exception ex)
            {
                LogHelper.WriteLine(ex.Message + ex.StackTrace);
            }
            finally
            {
                SetWorkingSet(750000);
            }
        }
        /*/// <summary>
         * /// 开始工作
         * /// </summary>
         * private void DoWork()
         * {
         *  for (int i = 0; i < 100; i++)
         *  {
         *      // 记录进度
         *      // 实际应用中需要进一步控制(利用用户信息、cookies等),防止并发造成混乱
         *      this.context.Application["progress"] = i + 1;
         *      Random r = new Random();
         *      Thread.Sleep(r.Next(10, 100));
         *  }
         *  // 完成后释放资源
         *  this.context.Application["progress"] = null;
         * }
         *
         * /// <summary>
         * /// 查询进度
         * /// </summary>
         * /// <returns>进度</returns>
         * private int GetProgress()
         * {
         *  if (this.context.Application["progress"] != null)
         *  {
         *      return (int)this.context.Application["progress"];
         *  }
         *  else
         *  {
         *      return -1;
         *  }
         * }*/

        /// <summary>
        /// 压缩
        /// </summary>
        /// <param name="type">任务类型</param>
        /// <param name="projectID">任务ID</param>
        /// <param name="finishedPerson">完成人ID</param>
        /// <returns></returns>
        public string Compress(string type, string projectID, string finishedPerson)
        {
            string result = "{\"result\":\"0\"}";

            try
            {
                string employeeRootPath = ConfigurationManager.AppSettings["employeePath"];
                //===================================== type为0,普通任务 =====================================
                if (type == "0")
                {
                    DataTable dt = new ProjectBLL().GetFinalScript(projectID, finishedPerson);

                    //string finishedPerson = context.Request["FinishedPerson"];

                    LogHelper.WriteLine("finishedPerson: " + finishedPerson);

                    //DataRow[] dr = dt.Select(string.Format("FINISHEDPERSON = '{0}'", finishedPerson));

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string employeeNo = dt.Rows[0]["EMPLOYEENO"].ToString(); //员工编号
                        string taskNo     = dt.Rows[0]["taskno"].ToString();     //任务目录

                        LogHelper.WriteLine("employeeNo: " + employeeNo);
                        LogHelper.WriteLine("taskNo: " + taskNo);

                        string currentEmpPath = string.Format("{0}{1}", employeeRootPath, employeeNo);//员工目录
                        LogHelper.WriteLine("currentEmpPath: " + currentEmpPath);
                        //遍历员工目录,即找出各个任务的目录
                        foreach (DirectoryInfo taskFolder in new DirectoryInfo(currentEmpPath).GetDirectories())
                        {
                            LogHelper.WriteLine("如果目录名是以任务名打头的,   上面    taskNo :   " + taskNo);
                            //如果目录名是以任务名打头的,说明就是它了,因为员工会在原文件夹名后面加上乱七八糟的东西。如果前面他也敢动,那我也没办法了。
                            if (taskFolder.Name.StartsWith(taskNo))
                            {
                                foreach (DirectoryInfo taskFolderChild in new DirectoryInfo(taskFolder.FullName).GetDirectories())
                                {
                                    if (taskFolderChild.Name == "完成稿")
                                    {
                                        string destinationFileName = taskFolderChild.FullName + ".zip";
                                        if (!File.Exists(destinationFileName))
                                        {
                                            //ZipHelper.CreateZip(taskFolder.FullName, taskFolder.FullName + ".zip");
                                            ZipHelper.CreateZipFile(taskFolder.FullName + "\\" + taskFolderChild.Name, destinationFileName);
                                            result = "{\"result\":\"1\"}";
                                            break;
                                        }
                                        else
                                        {
                                            result = "{\"result\":\"2\"}";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //===================================== type为1,售后任务 =====================================
                else if (type == "1")
                {
                    DataTable dt             = new ProjectBLL().GetProjectModifyByModifyID(projectID);
                    string    employeeNo     = dt.Rows[0]["employeeNo"].ToString();                   //员工编号
                    string    taskNo         = dt.Rows[0]["taskNo"].ToString();                       //任务目录
                    string    currentEmpPath = string.Format("{0}{1}", employeeRootPath, employeeNo); //员工目录
                    //遍历员工目录,即找出各个任务的目录
                    foreach (DirectoryInfo taskFolder in new DirectoryInfo(currentEmpPath).GetDirectories())
                    {
                        //如果目录名是以任务名打头的,说明就是它了,因为员工会在原文件夹名后面加上乱七八糟的东西。如果前面他也敢动,那我也没办法了。
                        if (taskFolder.Name.StartsWith(taskNo))
                        {
                            //修改记录目录
                            string modifyRecordFolder = ConfigurationManager.AppSettings["modifyRecordFolderName"].ToString();
                            //遍历单个任务目录下的文件夹
                            foreach (DirectoryInfo taskFolderChild in taskFolder.GetDirectories())
                            {
                                //如果目录名是“修改记录”
                                if (taskFolderChild.Name == modifyRecordFolder)
                                {
                                    //进一步遍历每次修改记录目录
                                    foreach (DirectoryInfo modifyFolder in taskFolderChild.GetDirectories())
                                    {
                                        //每次修改记录产生的文件夹
                                        string modifyFolderName = modifyFolder.Name;
                                        //数据库中存储的修改记录文件夹
                                        string dtFolderName = dt.Rows[0]["folderName"].ToString();
                                        //如果目录名包含“完成”并且是当前售后任务打头的,那么就是它了
                                        //if (modifyFolderName.Contains("完成") && modifyFolderName.StartsWith(dtFolderName))
                                        LogHelper.WriteLine("modifyFolderName == dtFolderName   :" + modifyFolderName + "----" + dtFolderName);
                                        if (modifyFolderName == dtFolderName)
                                        {
                                            if (Directory.Exists(modifyFolder.FullName))
                                            {
                                                string destinationFileName = modifyFolder.FullName + ".zip";
                                                if (!File.Exists(destinationFileName))
                                                {
                                                    ZipHelper.CreateZipFile(modifyFolder.FullName, destinationFileName);
                                                    result = "{\"result\":\"1\"}";
                                                    break;
                                                }
                                                else
                                                {
                                                    result = "{\"result\":\"2\"}";
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                        //break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLine("压缩失败!\r\n" + ex.Message);
                return("{\"result\":\"0\"}");
            }
            return(result);
        }
Esempio n. 27
0
        private void button10_Click(object sender, EventArgs e)
        {
            Workflow wf     = new Workflow();
            string   userid = "9";
            //ProjectBLL bll = new ProjectBLL();
            //bll.Add(new Project
            //{
            //    Creator = "9",
            //    Name = "test",
            //}, new List<Asset>(), new List<Customer_Project>(), new List<Customer>(), new List<Guarantor>(), "9"

            //);
            //处理流程
            ProjectBLL bll = new ProjectBLL();

            bll.Save(new Project
            {
                ID = "111",
            }, new List <Asset>
            {
                new Asset
                {
                    Code    = "test",
                    Address = "test",
                    Joint   = new List <Joint> {
                        new Joint {
                            Name = "test1", JointType = 1
                        }
                    },
                    Remark = "hello"
                }
            }, new List <Customer>
            {
                new Customer
                {
                    Name   = "test3",
                    Remark = "world",
                    Gender = 2,
                }
            }, new List <Customer>
            {
                new Customer
                {
                    Name   = "test4",
                    Remark = "yes",
                    Gender = 2,
                }
            }, null, null, null, "1");

            //WorkflowDefinitionModel wfdm = WorkflowDefinitionModel.LoadByName("额度申请");
            //var workflow = wfdm.StartNew(userid, "", new WorkflowAuthority());
            ////如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
            //var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
            //if (task != null)
            //{
            //    workflow.ProcessActivity(new Approval
            //    {
            //        Creator = userid,
            //        LastUpdator = userid,
            //        Remark = "test",
            //        Status = (int)ApprovalStatus.Agree,
            //        ActivityID = workflow.CurrentActivity.Value.ID,
            //        WorkflowID = workflow.Value.ID,
            //    }, userid, new WorkflowAuthority());
            //}
        }
Esempio n. 28
0
        /// <summary>
        /// 获得上传文件路径
        /// Created:2017.3.28(xuxb)
        /// Updated:2017.3.28(ChengMengjia)
        /// Updated:2017.4.12(zhuguanjun)
        /// Updated:2017.6.9(ChengMengjia) 日常工作的上传路径修改
        /// </summary>
        /// <param name="type"></param>
        /// <param name="projectId"></param>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public static string GetUploadPath(UploadType type, string projectId, string nodeId)
        {
            ProjectBLL projectBll = new ProjectBLL();
            WBSBLL     wbsBll     = new WBSBLL();
            string     baseNodeId = string.Empty;

            switch (type)
            {
            case UploadType.ContractHTSMJ:
                //上传项目合同扫描件
                return(projectBll.GetProjectPath(projectId) + "合同信息\\合同扫描件\\");;

            case UploadType.ContractHTDZD:
                //上传项目合同电子档
                return(projectBll.GetProjectPath(projectId) + "合同信息\\合同电子档\\");;

            case UploadType.ContractGZSMJ:
                //上传项目工作说明书扫描件
                return(projectBll.GetProjectPath(projectId) + "合同信息\\工作说明书扫描件\\");

            case UploadType.ContractGZDZD:
                //上传项目工作说明书电子档
                return(projectBll.GetProjectPath(projectId) + "合同信息\\工作说明书电子档\\");

            case UploadType.ContractZBDZD:
                //上传项目招标文件电子档
                return(projectBll.GetProjectPath(projectId) + "合同信息\\招标文件电子档\\");

            case UploadType.ContractTBDZD:
                //上传项目投标文件电子档
                return(projectBll.GetProjectPath(projectId) + "合同信息\\投标文件电子档\\");

            case UploadType.ContractQTFJ:
                //上传项目其他附件
                return(projectBll.GetProjectPath(projectId) + "合同信息\\其他附件\\");

            case UploadType.Project:
                //上传项目文件时
                return(projectBll.GetProjectPath(projectId));

            case UploadType.WBS:
                //上传WBS文件时
                return(wbsBll.GetWBSPath(projectId, nodeId));

            case UploadType.WeeklyModel:
            case UploadType.WBSModel:
                //周报模板
                return(Directory.GetCurrentDirectory() + "\\Template\\");

            case UploadType.Change:
                //上传变更文件时
                return(projectBll.GetProjectPath(projectId) + "变更管理\\");

            case UploadType.InCome:
                //上传收款文件时
                return(projectBll.GetProjectPath(projectId) + "营收管理\\收入\\");

            case UploadType.SubContract:
                //上传分包文件时
                return(projectBll.GetProjectPath(projectId) + "分包管理\\分包\\");

            case UploadType.Supplier:
                //上传供应商文件时
                return(projectBll.GetProjectPath(projectId) + "分包管理\\供应商\\");

            case UploadType.Routine:
                PNode rnode = wbsBll.GetNode(nodeId);    //日常工作节点
                //上传日常工作文件时
                return(projectBll.GetProjectPath(projectId) + wbsBll.GetWBSPath(projectId, rnode.ParentID, false)
                       + "日常工作\\" + rnode.Name + "\\");

            case UploadType.Trouble:
            case UploadType.TroubleReason:
            case UploadType.TroubleAnalyse:
            case UploadType.TroubleSolution:
                PNode tnode = wbsBll.GetNode(nodeId);    //问题节点
                //上传问题管理文件时
                return(projectBll.GetProjectPath(projectId) + wbsBll.GetWBSPath(projectId, tnode.ParentID, false)
                       + "问题管理\\" + tnode.Name + "\\");

            case UploadType.Report_Plan:
                return("报表\\项目计划\\");

            case UploadType.Report_Earning:
                return("报表\\收入情况\\");

            case UploadType.Report_Cost:
                return("报表\\成本分配\\");

            case UploadType.Report_Receivables:
                return("报表\\收款情况\\");

            case UploadType.Report_Weekly:
                return(projectBll.GetProjectPath(projectId) + "报表\\周报\\");

            case UploadType.Report_Dynamic:
                return("报表\\动态报表\\");

            case UploadType.Templet:
                return("模板");

            default:
                //上传项目其他文件时
                return(projectBll.GetProjectPath(projectId));
            }
        }
Esempio n. 29
0
 private void button15_Click(object sender, EventArgs e)
 {
     ProjectBLL bll = new ProjectBLL();
     var        a   = bll.QueryDetail(textBox1.Text, "", "14");
 }
 public RequestListForm()
 {
     InitializeComponent();
     _projectBLL     = new ProjectBLL();
     _requestTypeBLL = new RequestTypeBLL();
 }
Esempio n. 31
0
 private void button20_Click(object sender, EventArgs e)
 {
     Workflow   workflow = new Workflow();
     ProjectBLL bll      = new ProjectBLL();
     //bll.FinanceConfirm("3ed1b947f1d9401fa1b799a802d9d00a", "14", null, null, null, null, null, null, null);
 }
Esempio n. 32
0
        //加载转让信息
        public void InitApplicationTransfer()
        {
            //TuanDB.JunTeEntities dbRead = TuanDB.JunTeEntities.Read();
            Guid subscribeId = Guid.Empty;

            Guid.TryParse(Context.Request["id"], out subscribeId);
            Guid userId = WebUserAuth.UserId.Value;

            //TuanDB.Subscribe subscribeEntity = dbRead.Subscribe.FirstOrDefault(p => p.Id == subscribeId && p.SubscribeUserId == userId);

            var subscribeEntity = new SubscribeBLL().GetSubscribeById(subscribeId);

            if (subscribeEntity == null)
            {
                PrintJson("0", "数据异常");
                return;
            }
            ProjectBLL        bll           = new ProjectBLL();
            ProjectDetailInfo projectEntity = bll.GetProjectDetailInfo(subscribeEntity.ProjectId.Value);

            //Project projectEntity = dbRead.Project.FirstOrDefault(p => p.Id == subscribeEntity.ProjectId);
            if (projectEntity == null)
            {
                PrintJson("0", "数据异常");
                return;
            }

            InitApplicationtransferInfo initApplicationtransferEntity = new InitApplicationtransferInfo();

            initApplicationtransferEntity.Title             = projectEntity.Title;
            initApplicationtransferEntity.TypeName          = ToolStatus.ConvertProjectType(projectEntity.Type ?? 0);
            initApplicationtransferEntity.InterestRate      = projectEntity.InterestRate ?? 0;
            initApplicationtransferEntity.RepaymentTypeName = ToolStatus.ConvertRepaymentType(projectEntity.RepaymentType ?? 0);
            initApplicationtransferEntity.Deadline          = projectEntity.Deadline ?? 0;
            initApplicationtransferEntity.LowerUnit         = projectEntity.LowerUnit ?? 0;
            initApplicationtransferEntity.SubscribeShares   = subscribeEntity.SubscribeShares ?? 0;
            initApplicationtransferEntity.Amount            = "0";
            initApplicationtransferEntity.InterestAmount    = "0";
            //var subscribeDetailList = dbRead.SubscribeDetail.Where(p => p.SubscribeId == subscribeId);
            var subscribeDetailList = new SubscribeDetailBLL().GetSubscribeDetailListBySubscribeId(subscribeId);

            if (subscribeDetailList.Count() > 0)
            {
                initApplicationtransferEntity.Amount         = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.Amount));
                initApplicationtransferEntity.InterestAmount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.InterestAmout.Value));
            }
            initApplicationtransferEntity.RefundedMonths    = subscribeEntity.RefundedMonths ?? 0;
            initApplicationtransferEntity.TotalRefundMonths = subscribeEntity.TotalRefundMonths ?? 0;
            initApplicationtransferEntity.PreCycDate        = subscribeEntity.PreCycDate.HasValue ? subscribeEntity.PreCycDate.Value.ToString("yyyy-MM-dd") : "";

            string sql = string.Empty;

            if (projectEntity.RepaymentType == 1)//到期还本息
            {
                sql = "SELECT dateDiff(day,@BeginDate,getdate())-1";
            }
            else
            {
                sql = "SELECT dateDiff(day,dbo.f_GetRepaymentAdvance_Date(@BeginDate,@Month),getdate())";
            }
            var para = new Dapper.DynamicParameters();

            para.Add("@BeginDate", subscribeEntity.AddDate);
            para.Add("@Month", subscribeEntity.RefundedMonths);
            initApplicationtransferEntity.Days = PublicConn.QuerySingle <int>(sql, ref para);
            //using (SqlConnection connection = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString))
            //{
            //    connection.Open();
            //     int day = connection.Query<int>(sql, new { BeginDate = subscribeEntity.AddDate, Month = subscribeEntity.RefundedMonths }).First();
            //    connection.Close();
            //    connection.Dispose();
            //    initApplicationtransferEntity.Days = day;
            //}

            initApplicationtransferEntity.result = 1;
            PrintJson(initApplicationtransferEntity);
        }
Esempio n. 33
0
        ///// <summary>
        ///// 页码跳转
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //protected void btnGoPage_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        int pageindex = int.Parse(tb_pageindex.Text);
        //        AspNetPager1.CurrentPageIndex = pageindex;
        //    }
        //    catch (FormatException)
        //    {
        //        lbl_error.Text = "输入的页索引格式不正确";
        //    }
        //}
        #endregion

        #region Repeat Databound,计算提成金额、任务剩余时间和修改剩余时间
        protected void gvProject_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                #region 设置任务状态样式
                Label lblTaskStatus = e.Row.FindControl("lblTaskStatus") as Label;
                if (lblTaskStatus != null && !string.IsNullOrEmpty(lblTaskStatus.Text.Trim()))
                {
                    if (lblTaskStatus.Text.Trim() == "暂停")
                    {
                        lblTaskStatus.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000");
                    }
                }
                #endregion

                #region 计算提成金额
                #region 预计提成
                string  prjId      = gvProject.DataKeys[e.Row.RowIndex].Values[0].ToString();
                decimal proportion = 0m;
                // 先看此项目是否单独设置了提成
                ProjectProportion projectProportion = lstPrjProportion?.Where(item => item.PROJECTID == prjId).FirstOrDefault();  // new ProjectProportionBLL().GetModelList(" projectId = '" + prjId + "'").FirstOrDefault();
                // 如果设置了单独提成,则采用单独设置的比例
                if (projectProportion != null)
                {
                    proportion = projectProportion.PROPORTION ?? 0m;
                }
                // 如果未设置,则采用默认提成
                else if (empProportion != null)
                {
                    proportion = empProportion?.PROPORTION ?? 0m;
                }
                Label       lblExpectAmount = e.Row.FindControl("lblExpectAmount") as Label;
                HiddenField hidOrderAmount  = e.Row.FindControl("hidOrderAmount") as HiddenField;
                decimal     orderAmount     = Convert.ToDecimal(hidOrderAmount.Value);
                //Project prj = new ProjectBLL().GetModel(prjId);
                lblExpectAmount.Text = (orderAmount * Convert.ToDecimal(proportion)).ToString();
                //2019-03-26,未转正期间的任务隐藏预计提成
                Project project = new ProjectBLL().GetModel(prjId);
                if (project.CREATEDATE != null && toRegularDate != null)
                {
                    if (project.CREATEDATE <= toRegularDate || toRegularDate == Convert.ToDateTime("2000/1/1 00:00:00"))
                    {
                        lblExpectAmount.Text = "--";
                    }
                }
                #endregion

                #region 实际提成
                //decimal tcje = new TransactionDetailsBLL().GetModelList(" AND employeeId = '" + Convert.ToString(EmployeeID ?? string.Empty) + "' AND TRANSACTIONTYPE = 7 AND PROJECTID = '" + prjId + "' ").Sum(item => item.TRANSACTIONAMOUNT) ?? 0m;
                Label lblProportionAmount = e.Row.FindControl("lblProportionAmount") as Label;
                //lblProportionAmount.Text = tcje.ToString();
                if (lstTcje != null && lstTcje.Count() > 0)
                {
                    decimal transactionAmount = lstTcje.Where(item => item.PROJECTID == prjId && item.EMPLOYEEID == EmployeeID).Sum(item => item.TRANSACTIONAMOUNT) ?? 0m;
                    lblProportionAmount.Text = transactionAmount.ToString();
                }
                else
                {
                    lblProportionAmount.Text = "0";
                }
                #endregion
                #endregion

                #region 计算任务剩余时间
                bool  isFinished    = Convert.ToInt32(gvProject.DataKeys[e.Row.RowIndex].Values[1]) == 1;
                Label lblTimeRemain = e.Row.FindControl("lblTimeRemain") as Label;
                //未完成的,才显示剩余时间
                if (lblTimeRemain != null && !isFinished)
                {
                    HiddenField hidExpireDate = e.Row.FindControl("hidExpireDate") as HiddenField;
                    DateTime    dtExpire      = Convert.ToDateTime(hidExpireDate.Value);
                    if (DateTime.Now < dtExpire)
                    {
                        TimeSpan ts = dtExpire - DateTime.Now;

                        //设置提醒label文本
                        lblTimeRemain.Text = string.Format("{0}小时", Math.Floor(ts.TotalHours));
                        if (ts.TotalHours <= 3)
                        {
                            lblTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000");//不足3小时,红色
                            lblTimeRemain.Font.Bold = true;
                        }
                        else if (ts.TotalHours <= 6)
                        {
                            lblTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF8800");//不足6小时,橙色
                            lblTimeRemain.Font.Bold = true;
                        }
                        else if (ts.TotalHours <= 12)
                        {
                            lblTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#EEEE00");//不足12小时,黄色
                            lblTimeRemain.Font.Bold = true;
                        }
                        else if (ts.TotalHours <= 24)
                        {
                            lblTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF77FF");//不足24小时,洋红色
                        }
                        else if (ts.TotalHours <= 48)
                        {
                            lblTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#57C600");//48小时以上,酸橙色(浅绿)
                        }
                        else
                        {
                            lblTimeRemain.Text = "&gt;2天";
                        }
                    }
                    else if (dtExpire < DateTime.Now)
                    {
                        TimeSpan ts = DateTime.Now - dtExpire;
                        lblTimeRemain.Text      = string.Format("逾期{0}", Common.TransformTimeSpan(ts));
                        lblTimeRemain.ForeColor = System.Drawing.Color.Red;
                    }
                }
                #endregion

                #region 计算修改剩余时间
                string    projectId = gvProject.DataKeys[e.Row.RowIndex].Values[0].ToString();
                Label     lblModifyTaskTimeRemain = e.Row.FindControl("lblModifyTaskTimeRemain") as Label;
                DataTable dt = new FileCategoryBLL().GetExpireDateByProjectId(projectId).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    Button btnSetModifyTasksFinished = e.Row.FindControl("btnSetModifyTasksFinished") as Button;
                    btnSetModifyTasksFinished.Visible = true;
                    string folderName = Convert.ToString(dt.Rows[0]["folderName"]);
                    btnSetModifyTasksFinished.CommandArgument = projectId + "|" + folderName;
                    if (folderName.Contains("修改"))
                    {
                        string strExpireDate = Convert.ToString(dt.Rows[0]["expireDate"]);

                        DateTime dtExpire = Convert.ToDateTime(strExpireDate);
                        if (DateTime.Now < dtExpire)
                        {
                            TimeSpan ts = dtExpire - DateTime.Now;
                            //设置提醒label文本
                            lblModifyTaskTimeRemain.Text = string.Format("{0}剩余{1}小时", folderName, Math.Floor(ts.TotalHours));
                            if (ts.TotalHours <= 3)
                            {
                                lblModifyTaskTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000");//不足3小时,红色
                                lblModifyTaskTimeRemain.Font.Bold = true;
                            }
                            else if (ts.TotalHours <= 6)
                            {
                                lblModifyTaskTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF8800");//不足6小时,橙色
                                lblModifyTaskTimeRemain.Font.Bold = true;
                            }
                            else if (ts.TotalHours <= 12)
                            {
                                lblModifyTaskTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#EEEE00");//不足12小时,黄色
                                lblModifyTaskTimeRemain.Font.Bold = true;
                            }
                            else if (ts.TotalHours <= 24)
                            {
                                lblModifyTaskTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF77FF");//不足24小时,洋红色
                            }
                            else if (ts.TotalHours <= 48)
                            {
                                lblModifyTaskTimeRemain.ForeColor = System.Drawing.ColorTranslator.FromHtml("#57C600");//48小时以上,酸橙色(浅绿)
                            }
                            else
                            {
                                lblModifyTaskTimeRemain.Text = string.Format("{0}剩余&gt;2天", folderName);
                            }
                        }
                        else if (dtExpire < DateTime.Now)
                        {
                            TimeSpan ts = DateTime.Now - dtExpire;
                            lblModifyTaskTimeRemain.Text      = string.Format("{0}逾期{1}", folderName, Common.TransformTimeSpan(ts));
                            lblModifyTaskTimeRemain.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                }
                #endregion
            }
        }
Esempio n. 34
0
    protected void FormViewTlProject_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        Project project = new ProjectBLL().GetProjectByProjectId2((int)e.Keys["ProjectId"]);

        using (DatabaseContext _DatabaseContext = new DatabaseContext())
        {
            // ProjectInfoTreeLocation
            TextBox txtX = (TextBox)formViewTlProject.FindControl("txtX");
            TextBox txtY = (TextBox)formViewTlProject.FindControl("txtY");

            TextBox txtLat = (TextBox)formViewTlProject.FindControl("txtLat");
            TextBox txtLon = (TextBox)formViewTlProject.FindControl("txtLon");

            TextBox         txtParkings             = (TextBox)formViewTlProject.FindControl("txtParkings");
            RadioButtonList rblCalc                 = (RadioButtonList)formViewTlProject.FindControl("rblCalc");
            TextBox         txtAcres                = (TextBox)formViewTlProject.FindControl("txtAcres");
            DropDownList    ddlDistanceBetweenTrees = (DropDownList)formViewTlProject.FindControl("ddlDistanceBetweenTrees");
            TextBox         txtLots0                = (TextBox)formViewTlProject.FindControl("txtLots0");
            TextBox         txtLots1                = (TextBox)formViewTlProject.FindControl("txtLots1");
            TextBox         txtLots2                = (TextBox)formViewTlProject.FindControl("txtLots2");
            TextBox         txtLots3                = (TextBox)formViewTlProject.FindControl("txtLots3");
            RadioButtonList rblSocialInterest       = (RadioButtonList)formViewTlProject.FindControl("rblSocialInterest");
            RadioButtonList rblPreviouslyImpacted   = (RadioButtonList)formViewTlProject.FindControl("rblPreviouslyImpacted");

            ProjectInfoTreeLocation projectInfoTreeLocation = project.ProjectInfoTreeLocations.Count == 0 ? new ProjectInfoTreeLocation() : _DatabaseContext.ProjectInfoTreeLocations.First(instance => instance.ProjectID == project.ProjectID);

            decimal dec;
            int     integer;

            RadioButtonList rblPosition = (RadioButtonList)formViewTlProject.FindControl("rblPosition");

            if (rblPosition.SelectedValue == "0") // Nad83
            {
                projectInfoTreeLocation.X = decimal.TryParse(txtX.Text, out dec) ? Convert.ToDecimal(txtX.Text) : 0;
                projectInfoTreeLocation.Y = decimal.TryParse(txtY.Text, out dec) ? Convert.ToDecimal(txtY.Text) : 0;

                if (projectInfoTreeLocation.X != 0 && projectInfoTreeLocation.Y != 0)
                {
                    Dictionary <string, object> anewpointObj = Utility.ConvertToLatLng(projectInfoTreeLocation.X.ToString(), projectInfoTreeLocation.Y.ToString(), @"~/App_Resources/client-scripts/tl/");

                    projectInfoTreeLocation.Lat = Convert.ToDecimal(anewpointObj["y"]);
                    txtLat.Text = projectInfoTreeLocation.Lat.ToString();
                    projectInfoTreeLocation.Lon = Convert.ToDecimal(anewpointObj["x"]);
                    txtLon.Text = projectInfoTreeLocation.Lon.ToString();
                }
                else
                {
                    projectInfoTreeLocation.Lat = 0;
                    projectInfoTreeLocation.Lon = 0;
                }
            }
            else // StatePlanes
            {
                projectInfoTreeLocation.Lat = decimal.TryParse(txtLat.Text, out dec) ? Convert.ToDecimal(txtLat.Text) : 0;
                projectInfoTreeLocation.Lon = decimal.TryParse(txtLon.Text, out dec) ? Convert.ToDecimal(txtLon.Text) : 0;

                if (projectInfoTreeLocation.Lat != 0 && projectInfoTreeLocation.Lon != 0)
                {
                    Dictionary <string, object> anewpointObj = Utility.ConvertToStatePlane(projectInfoTreeLocation.Lon.ToString(), projectInfoTreeLocation.Lat.ToString(), @"~/App_Resources/client-scripts/tl/");

                    projectInfoTreeLocation.X = Convert.ToDecimal(anewpointObj["x"]);
                    txtX.Text = projectInfoTreeLocation.X.ToString();
                    projectInfoTreeLocation.Y = Convert.ToDecimal(anewpointObj["y"]);
                    txtY.Text = projectInfoTreeLocation.Y.ToString();
                }
                else
                {
                    projectInfoTreeLocation.X = 0;
                    projectInfoTreeLocation.Y = 0;
                }
            }

            projectInfoTreeLocation.Parkings             = Int32.TryParse(txtParkings.Text, out integer) ? Convert.ToInt32(txtParkings.Text) : 0;
            projectInfoTreeLocation.Acres                = decimal.TryParse(txtAcres.Text, out dec) ? Convert.ToDecimal(txtAcres.Text) : 0;
            projectInfoTreeLocation.DistanceBetweenTrees = null;
            projectInfoTreeLocation.PreviouslyImpacted   = null;

            projectInfoTreeLocation.Mitigation = Convert.ToInt32(rblCalc.SelectedValue);
            if (Convert.ToInt32(rblCalc.SelectedValue) > 1)
            {                                                   // Cálculo por perímetro
                projectInfoTreeLocation.Lots0 = projectInfoTreeLocation.Lots1 = projectInfoTreeLocation.Lots2 = projectInfoTreeLocation.Lots3 = 0;
                if (rblPreviouslyImpacted.SelectedValue == "0") // Previamente impactado = No
                {
                    projectInfoTreeLocation.DistanceBetweenTrees = Int32.TryParse(ddlDistanceBetweenTrees.SelectedValue, out integer) ? Convert.ToInt32(ddlDistanceBetweenTrees.SelectedValue) : 0;
                }
                projectInfoTreeLocation.PreviouslyImpacted = rblPreviouslyImpacted.SelectedValue == "1";
            }
            else
            {// Cálculo por solares
                projectInfoTreeLocation.Lots0 = Int32.TryParse(txtLots0.Text, out integer) ? integer : 0;
                projectInfoTreeLocation.Lots1 = Int32.TryParse(txtLots1.Text, out integer) ? integer : 0;
                projectInfoTreeLocation.Lots2 = Int32.TryParse(txtLots2.Text, out integer) ? integer : 0;
                projectInfoTreeLocation.Lots3 = Int32.TryParse(txtLots3.Text, out integer) ? integer : 0;
                projectInfoTreeLocation.DistanceBetweenTrees = null;
            }

            projectInfoTreeLocation.SocialInterest = rblSocialInterest.SelectedValue == "1";

            projectInfoTreeLocation.ProjectID = project.ProjectID;
            projectInfoTreeLocation.ProjectReference.EntityKey = project.EntityKey;

            if (project.ProjectInfoTreeLocations.Count == 0)
            {
                new ProjectInfoTreeLocationBLL().CreateNewProjectInfoTreeLocation(projectInfoTreeLocation);
            }
            else
            {
                _DatabaseContext.SaveChanges();
            }
            //
        }

        Type myType = (typeof(Project));

        PropertyInfo[] props = myType.GetProperties();

        string[] arrNewValues = new string[e.NewValues.Keys.Count];
        e.NewValues.Keys.CopyTo(arrNewValues, 0);

        foreach (var prop in props)
        {
            if (("System.String,System.Int,System.DateTime,System.Guid").IndexOf((prop.PropertyType).FullName) >= 0) // Si la propiedad es de tipo Guid, String, Int o DateTime
            {
                if (!arrNewValues.Contains(prop.Name))
                {
                    e.NewValues[prop.Name] = prop.GetValue(project, null);
                }
            }
        }

        User editor = new UserBLL().GetUserByUserName((HttpContext.Current.User.Identity).Name);

        e.NewValues["EditorUserId"] = editor.UserID.ToString();
        e.NewValues["EditedDate"]   = DateTime.Now;
        //}
        //else
        //{
        //    ltlMessage.Text = MessageFormatter.GetFormattedErrorMessage(GetErrorMessage(status));
        //    e.Cancel = true;
        //}
    }
Esempio n. 35
0
        /// 绑定系统信息表   --add on 20170610 by Lingjia Qiu
        /// <summary>
        /// 绑定系统信息表
        /// </summary>
        /// <param name="riItem"></param>
        private void BindSysTableInfo(RoomIndoor r)
        {
            if (thisProject.SystemList.Count == 0)
            {
                return;
            }

            dgvSystemInfo.Rows.Clear();  //清空数据
            ProjectBLL bll = new ProjectBLL(thisProject);

            foreach (SystemVRF sysItem in thisProject.SystemList)
            {
                if (sysItem.OutdoorItem == null)
                {
                    this.dgvSystemInfo.Visible = false;
                    return;
                }
                if (sysItem.Id.Equals(r.SystemID))
                {
                    //this.jclblUnitInfo.Text = sysItem.Name + ShowText.SystemInfo;
                    double totestIndCap_h = 0;
                    double totestIndCap_c = getTotestIndCap_c(sysItem, bll, out totestIndCap_h);
                    string coolingReqd    = "";
                    if (totestIndCap_c != 0d)
                    {
                        coolingReqd = Unit.ConvertToControl(totestIndCap_c, UnitType.POWER, ut_power).ToString("n1");
                    }
                    else
                    {
                        coolingReqd = "-";
                    }

                    double sysRH = bll.CalculateRH(sysItem.DBHeating, sysItem.WBHeating, thisProject.Altitude);
                    //this.dgvSystemInfo.Rows[0].Height = 30;
                    //先添加一条系统室外机记录
                    this.dgvSystemInfo.Rows.Add(
                        "",
                        coolingReqd,                                                                                                 // cooling Req'd
                        totestIndCap_h != 0d ? Unit.ConvertToControl(totestIndCap_h, UnitType.POWER, ut_power).ToString("n1") : "-", //Heating Req'd
                        "-",                                                                                                         //Sensible Req'd
                        sysItem.Name,                                                                                                //系统名字
                        sysItem.OutdoorItem.AuxModelName,                                                                            //室外机型号
                        Unit.ConvertToControl(sysItem.CoolingCapacity, UnitType.POWER, ut_power).ToString("n1"),                     //Cooling Actual
                        Unit.ConvertToControl(sysItem.HeatingCapacity, UnitType.POWER, ut_power).ToString("n1"),                     //Heating Actual
                        "-",
                        Unit.ConvertToControl(sysItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //CoolingDB
                        "-",                                                                                                         //CoolingWB
                        Unit.ConvertToControl(sysItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //HeatingDB
                        Unit.ConvertToControl(sysItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //HeatingWB
                        (sysRH * 100).ToString("n0")                                                                                 //RH
                        );


                    //添加系统室内机记录
                    List <RoomIndoor> riItemList = bll.GetSelectedIndoorBySystem(sysItem.Id);
                    int    colorIndex            = 0;
                    string RoomId       = "";
                    string SensibleHeat = "";
                    foreach (RoomIndoor riItem in riItemList)
                    {
                        double riRH = (new ProjectBLL(thisProject)).CalculateRH(riItem.DBCooling, riItem.WBCooling, thisProject.Altitude);
                        //添加不基于房间的室内机riItem.IndoorName 改为 DisplayRoom
                        string DisplayRoom       = string.IsNullOrEmpty(riItem.DisplayRoom) ? riItem.IndoorName : riItem.DisplayRoom + ":" + riItem.IndoorName;
                        string RqCoolingCapacity = riItem.RqCoolingCapacity != 0d ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RqHeatingCapacity = riItem.RqHeatingCapacity != 0d ? Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RqSensibleHeat    = riItem.RqSensibleHeat != 0d ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RoomName          = "-";
                        if (!string.IsNullOrEmpty(riItem.RoomName) && !string.IsNullOrEmpty(riItem.RoomID))
                        {
                            if (RoomId != riItem.RoomID)
                            {
                                RoomName = riItem.RoomName;
                                Room ri = bll.GetRoom(riItem.RoomID);
                                RqCoolingCapacity = ri.RqCapacityCool != 0d ? Unit.ConvertToControl(ri.RqCapacityCool, UnitType.POWER, ut_power).ToString("n1") : " ";
                                RqHeatingCapacity = ri.RqCapacityHeat != 0d ? Unit.ConvertToControl(ri.RqCapacityHeat, UnitType.POWER, ut_power).ToString("n1") : " ";
                                RqSensibleHeat    = ri.SensibleHeat != 0d ? Unit.ConvertToControl(ri.SensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-";
                                RoomId            = riItem.RoomID;
                                SensibleHeat      = RqSensibleHeat;
                            }
                            else
                            {
                                RoomName          = "";
                                RqCoolingCapacity = "";
                                RqHeatingCapacity = "";
                                RqSensibleHeat    = "";
                                //if (!string.IsNullOrEmpty(SensibleHeat) && SensibleHeat == "-")
                                //    RqSensibleHeat = "-";
                            }
                        }

                        this.dgvSystemInfo.Rows.Add(
                            RoomName,
                            //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   // cooling Req'd
                            RqCoolingCapacity,                       // cooling Req'd
                            RqHeatingCapacity,                       //Heating Req'd
                            RqSensibleHeat,
                            //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   //Sensible Req'd
                            riItem.IndoorName,                                                                                                           //室内机名字
                            thisProject.BrandCode == "Y" ? riItem.IndoorItem.Model_York : riItem.IndoorItem.Model_Hitachi,                               //室内机型号
                            Unit.ConvertToControl(riItem.ActualCoolingCapacity, UnitType.POWER, ut_power).ToString("n1"),                                //Cooling Actual
                            //riItem.IsAuto ?Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   //Heating Req'd
                            Unit.ConvertToControl(riItem.ActualHeatingCapacity, UnitType.POWER, ut_power).ToString("n1"),                                //Heating Actual
                            Unit.ConvertToControl(riItem.ActualSensibleHeat, UnitType.POWER, ut_power).ToString("n1"),                                   //Sensible Actual
                            Unit.ConvertToControl(riItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //CoolingDB
                            Unit.ConvertToControl(riItem.WBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //CoolingWB
                            Unit.ConvertToControl(riItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //HeatingDB
                            riItem.WBHeating != 0d ? Unit.ConvertToControl(riItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1") : "-", //HeatingWB
                            (riRH * 100).ToString("n0")                                                                                                  //RH
                            );
                        colorIndex++;
                        string wType;
                        if (!CommonBLL.MeetRoomRequired(riItem, thisProject, 0, thisProject.RoomIndoorList, out wType))
                        {
                            dgvSystemInfo.Rows[colorIndex].Cells[1].Style.ForeColor = Color.Chocolate;
                            switch (wType)
                            {
                            case "reqCool":
                                dgvSystemInfo.Rows[colorIndex].Cells[4].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[5].Style.ForeColor = Color.Chocolate;
                                break;

                            case "reqHeat":
                                dgvSystemInfo.Rows[colorIndex].Cells[10].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[11].Style.ForeColor = Color.Chocolate;
                                break;

                            case "sensible":
                                dgvSystemInfo.Rows[colorIndex].Cells[6].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[7].Style.ForeColor = Color.Chocolate;
                                break;
                            }
                        }
                    }

                    break;
                }
            }
            dgvSystemInfo.ClearSelection();   //取消默认选中
            this.dgvSystemInfo.Visible = true;
        }
Esempio n. 36
0
        public IDUEquipmentPropertiesViewModel(JCHVRF.Model.Project projectLegacy, RoomIndoor roomIndoor)
        {
            try
            {
                this.ProjectLegacy = projectLegacy;
                pbll = new ProjectBLL(this.ProjectLegacy);

                this.indoorBLL = new IndoorBLL(ProjectLegacy.SubRegionCode, ProjectLegacy.RegionCode, ProjectLegacy.BrandCode);
                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    this.EquipmentName = roomIndoor.IndoorName;
                    this.SelectedFloor = roomIndoor.RoomName;
                }
                // End Bind Equipment Pre Selected Data To View Model
                GetFloorList();


                BindFanSpeed();
                BindToControl();


                // Bind Equipment Pre Selected Data To View Model
                //if (this.SelectedFanSpeed != null)
                //{
                if (roomIndoor != null)
                {
                    this.SelectedFanSpeed = roomIndoor.FanSpeedLevel;
                    if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
                    {
                        GetTypeLookUpData(roomIndoor.DisplayImageName);
                    }
                    else
                    {
                        GetTypeLookUpDataRegionWise(roomIndoor.DisplayImageName);
                    }
                }// roomIndoor.FanSpeedLevel == 1 ? "Max" : roomIndoor.FanSpeedLevel == 0 ? "High2" : roomIndoor.FanSpeedLevel == 1 ? "High" : roomIndoor.FanSpeedLevel == 2 ? "Medium" : roomIndoor.FanSpeedLevel == 3 ? "Low" : "";
                 // }
                 // End Bind Equipment Pre Selected Data To View Model



                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem.DisplayName != null)
                    {
                        this.SelectedType = roomIndoor.IndoorItem.DisplayName;
                    }
                    // End Bind Equipment Pre Selected Data To View Model
                    // GetSelectedIDUAccessories();


                    //this.AddAccessoryViewModel = new AddAccessoriesTemplateViewModel(this.ProjectLegacy, roomIndoor);
                    OnPropertyChanged(AddAccessoryViewModel.Accessories.ToString());
                }


                //SetEquipmentProperties();
                //To Select

                if (roomIndoor != null && roomIndoor.IndoorItem != null)
                {
                    // this.SelectedType = roomIndoor.IndoorItem.Type;
                }

                // Bind Equipment for Pre Selected Data
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.Model != null)
                    {
                        this.SelectedModel = roomIndoor.IndoorItem.Model;
                        //this.SelectedIndexModel = this.ListModel.FindIndex(a => a.Value == roomIndoor.IndoorItem.Model);
                    }
                    else
                    {
                        if (ListModel != null && ListModel.Count > 0)
                        {
                            this.SelectedModel = ListModel.FirstOrDefault().Value;
                        }
                    }
                }

                if (roomIndoor != null && roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.ListAccessory != null)
                {
                    var itemIndex = this.ProjectLegacy.RoomIndoorList.FindIndex(x => x.IndoorNO == roomIndoor.IndoorNO);
                    var item      = this.ProjectLegacy.RoomIndoorList.ElementAt(itemIndex);
                    this.ProjectLegacy.RoomIndoorList.RemoveAt(itemIndex);
                    item.ListAccessory = roomIndoor.IndoorItem.ListAccessory;
                    this.ProjectLegacy.RoomIndoorList.Insert(itemIndex, item);
                }
                // this.SelectedFanSpeed = 0;
                // End Bind Equipment Pre Selected Data To View Model
            }
            catch (Exception ex)
            {
                int?id = JCHVRF.Model.Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }
Esempio n. 37
0
 private void button12_Click(object sender, EventArgs e)
 {
     //QueryMyApplyRequest request = new QueryMyApplyRequest();
     //request.token = token;
     //var response = SDKFactory.Client.Execute(request);
     //MessageBox.Show(response.ResponseBody);
     Workflow workflow = new Workflow();
     RoleBLL rolebll = new RoleBLL();
     ProjectBLL projectbll = new ProjectBLL();
     var list = rolebll.GetUserSubUserIDs("14");
     var data = projectbll.QueryMyApply(new QueryMyApplyServiceForm { Creators = list });
 }