/// <summary> /// Returns the coefficient to be used in order to display the results according to the preferences of the IResult /// object used to create the instance of this object. Returns the prefered functional unit divided by the functional unit. /// /// In case of the FunctionalUnit is null or the PreferedUnit is null, this method returns a ratio of 1. This is usefull to /// display the Inputs results and the TransportationSteps results which are accounted for all outputs and not a specific one. /// In these cases instead of defining a PreferedUnit for each output we prefer to define none to make things simpler (see InputResult.GetResults) /// /// Before display all results must be multiplied by this coefficient /// /// May return a NullReferenceExeption if the IResult object does not define FunctinoalUnit, PreferedDisplayedUnit or PreferedDisplayedAmount /// </summary> /// <param name="results"></param> /// <returns></returns> internal static double GetFunctionalRatio(GData data, Results results, int producedResourceId) { if (results != null && results.CustomFunctionalUnitPreference != null && results.CustomFunctionalUnitPreference.PreferredUnitExpression != null) { LightValue functionalUnit = new LightValue(1.0, results.BottomDim); LightValue preferedFunctionalUnit = GetPreferedVisualizationFunctionalUnit(data, results, producedResourceId); switch (preferedFunctionalUnit.Dim) { case DimensionUtils.MASS: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToMass(functionalUnit); } break; case DimensionUtils.ENERGY: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToEnergy(functionalUnit); } break; case DimensionUtils.VOLUME: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToVolume(functionalUnit); } break; } return(preferedFunctionalUnit.Value / functionalUnit.Value); } else { return(1); } }
/// <summary> /// 1.2.1审批流程到审批者,通知审批者 /// </summary> /// <param name="user">申请人</param> /// <param name="master">核心信息</param> /// <param name="master">业务描述(机票,采购)</param> /// <param name="to_user">审批人</param> public void work_follow_star_notice_user(int user, string master, string business_text, int to_user) { //【审批通知】你收到[赵泽辉]的待审核的(采购,机票)(Ap2790)信息,快登陆中力家审批吧 List <string> list = new List <string>(); list.Add(GData.get_user_name(user.ToString())); list.Add(business_text + "(" + master + ")"); string temp = "审批通知:你收到{1}的待审核的{2}信息,快登陆中力家审批吧"; string str_full_content = temp; for (int i = 0; i < list.Count; i++) { str_full_content = str_full_content.Replace("{" + (i + 1).ToString() + "}", list[i]); } SP_SMS obj = new SP_SMS(); obj.SM_TEMP_ID = "392035"; obj.SM_SHORT_CONTENT = string.Join(",", list.ToArray());; obj.SM_FULL_CONTENT = str_full_content; obj.SM_PHONE = GData.get_user_phone(to_user.ToString()); obj.SM_CREATE_DATE = DateTime.Now; obj.SM_IS_SEND = false; db.SP_SMS.Add(obj); db.SaveChanges(); }
/// <summary> /// 1.2.2审批暂停通知申请人 /// </summary> /// <param name="user">申请人</param> /// <param name="master">核心信息</param> /// <param name="master">业务描述(机票,采购)</param> /// <param name="to_user">审批人</param> public void work_follow_stop_notice_user(int user, string master, string business_text, int to_user) { //【审批停顿】你申请的(采购,机票)信息(DH232444)还没完成审批。请你线下与[赵泽辉]沟通审批进度 List <string> list = new List <string>(); list.Add(business_text + "(" + master + ")"); list.Add(GData.get_user_name(to_user.ToString())); string temp = "审批停顿:你申请的{1}还没完成审批。请你线下与{2}沟通审批进度"; string str_full_content = temp; for (int i = 0; i < list.Count; i++) { str_full_content = str_full_content.Replace("{" + (i + 1).ToString() + "}", list[i]); } SP_SMS obj = new SP_SMS(); obj.SM_TEMP_ID = "395658"; obj.SM_SHORT_CONTENT = string.Join(",", list.ToArray());; obj.SM_FULL_CONTENT = str_full_content; obj.SM_PHONE = GData.get_user_phone(user.ToString()); obj.SM_CREATE_DATE = DateTime.Now; obj.SM_IS_SEND = false; db.SP_SMS.Add(obj); db.SaveChanges(); }
/// <summary> /// 1.1.1审批完成通知申请人 /// </summary> /// <param name="user">申请人</param> /// <param name="master">核心信息</param> /// <param name="business_text">业务描述(机票,采购)</param> /// <param name="status">状态【0=待审核,1已审核,2未通过,3=待终审,4已撤回】</param> public void work_follow_end_notice_user(int user, string master, string business_text, int status) { //【审批完成】你申请的(采购,机票)(DH232444)审核结果为审批通过。 List <string> list = new List <string>(); list.Add(business_text + "(" + master + ")"); list.Add(GData.get_status_name(status.ToString())); string temp = "审批完成:你申请的{1}审核结果为{2},请登陆中力家查看"; string str_full_content = temp; for (int i = 0; i < list.Count; i++) { str_full_content = str_full_content.Replace("{" + (i + 1).ToString() + "}", list[i]); } SP_SMS obj = new SP_SMS(); obj.SM_TEMP_ID = "395663"; obj.SM_SHORT_CONTENT = string.Join(",", list.ToArray());; obj.SM_FULL_CONTENT = str_full_content; obj.SM_PHONE = GData.get_user_phone(user.ToString()); obj.SM_CREATE_DATE = DateTime.Now; obj.SM_IS_SEND = false; db.SP_SMS.Add(obj); db.SaveChanges(); }
public bool update_form_status(int id, int status, int function_code) { H5Objects o = GData.GetObject(function_code); StringBuilder strsql = new StringBuilder(); List <SqlParameter> list_para = new List <SqlParameter>(); strsql.Append("update " + o.HO_TABLE_NAME + " set " + o.HO_STAUTS_FIELD + "=@" + o.HO_STAUTS_FIELD + " where " + o.HO_ID_FIELD + "=@" + o.HO_ID_FIELD); list_para.Add(new SqlParameter("@" + o.HO_STAUTS_FIELD, status)); list_para.Add(new SqlParameter("@" + o.HO_ID_FIELD, id)); SqlConnection cn = comm_fun.get_cn(); try { return(comm_fun.ExecuteNonQuery(strsql.ToString(), cn, list_para)); } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); return(false); } finally { comm_fun.CloseConnection(cn); } }
private void Button1_Click(object sender, EventArgs e) { if (GData.OpenFile("VS成员注释文档|*.xml", out var files)) { listBox1.Items.AddRange(files); } }
// FixedUpdate is called one per specific time void FixedUpdate() { float moveHorizontal = Input.GetAxis("Horizontal"); //Get if Any Horizontal Keys pressed float moveVertical = Input.GetAxis("Vertical"); //Get if Any Vertical Keys pressed GData bipolarMidpoint = gs.getBipolarMidpoint(); if (bipolarMidpoint != null && bipolarMidpoint.getIntensityInGauss() > 0) { moveHorizontal = (bipolarMidpoint.getX() - 0.5f) * 2; moveVertical = -(bipolarMidpoint.getY() - 0.5f) * 2; float angle = -bipolarMidpoint.getAngle() * Mathf.Rad2Deg; this.transform.rotation = Quaternion.Euler(0, 0, angle); } Vector2 movement = new Vector2(moveHorizontal, moveVertical); //Put them in a Vector2 Variable (x,y) GetComponent <Rigidbody2D>().velocity = movement * speed; //Add Velocity to the player ship rigidbody //Lock the position in the screen by putting a boundaries GetComponent <Rigidbody2D>().position = new Vector2 ( Mathf.Clamp(GetComponent <Rigidbody2D>().position.x, boundary.xMin, boundary.xMax), //X Mathf.Clamp(GetComponent <Rigidbody2D>().position.y, boundary.yMin, boundary.yMax) //Y ); }
/// <summary> /// Returns the coefficient to be used in order to display the results according to the preferences of the IResult /// object used to create the instance of this object. Returns the prefered functional unit divided by the functional unit. /// /// In case of the FunctionalUnit is null or the PreferedUnit is null, this method returns a ratio of 1. This is usefull to /// display the Inputs results and the TransportationSteps results which are accounted for all outputs and not a specific one. /// In these cases instead of defining a PreferedUnit for each output we prefer to define none to make things simpler (see InputResult.GetResults) /// /// Before display all results must be multiplied by this coefficient /// /// May return a NullReferenceExeption if the IResult object does not define FunctinoalUnit, PreferedDisplayedUnit or PreferedDisplayedAmount /// </summary> /// <param name="results"></param> /// <returns></returns> internal static double GetFunctionalRatio(GData data, Results results, int producedResourceId) { if (results != null && results.CustomFunctionalUnitPreference != null && results.CustomFunctionalUnitPreference.PreferredUnitExpression != null) { LightValue functionalUnit = new LightValue(1.0, results.BottomDim); LightValue preferedFunctionalUnit = GetPreferedVisualizationFunctionalUnit(data, results, producedResourceId); switch (preferedFunctionalUnit.Dim) { case DimensionUtils.MASS: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToMass(functionalUnit); } break; case DimensionUtils.ENERGY: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToEnergy(functionalUnit); } break; case DimensionUtils.VOLUME: // HARDCODED { functionalUnit = data.ResourcesData[producedResourceId].ConvertToVolume(functionalUnit); } break; } return preferedFunctionalUnit.Value / functionalUnit.Value; } else return 1; }
public ActionResult Genetic3(GData item) { item = gitem; item.kf[0] = new List <double>() { 100 - 83, 100 - 89, 100 - 95, 100 - 98 }; item.Solve(); return(View("Genetic", item)); }
public ActionResult Genetic1(GData item) { item = gitem; item.kf[0] = new List <double>() { 105 - 83 - 83 * 0.05, 105 - 89 - 89 * 0.05, 105 - 95 - 95 - 0.05, 105 - 98 - 98 * 0.05 }; item.Solve(); return(View("Genetic", item)); }
public ActionResult Genetic2(GData item) { item = gitem; item.kf[2] = new List <double>() { 120 - 120 * 0.05, 90 - 90 * 0.05, 80 - 80 * 0.05, 70 - 70 * 0.05, 2800000 }; item.Solve(); return(View("Genetic", item)); }
/// <summary> /// 1审批表单主表处理 /// </summary> /// <param name="item_function">业务类型</param> private void work_follow_master(int item_function) { //【待审核通知】查询出所有状态为0或者3(待审核,待终审)的数据 H5Objects o = GData.GetObject(item_function); StringBuilder strsql = new StringBuilder(); strsql.Append("select "); strsql.Append(o.HO_ID_FIELD + " as id"); strsql.Append("," + o.HO_USER_FIELD + " as user_id"); strsql.Append("," + o.HO_MASTER_FIELD + " as master"); strsql.Append(" from " + o.HO_TABLE_NAME); strsql.Append(" where " + o.HO_STAUTS_FIELD + " in (0,3)"); DataTable dt = GetDataTable(strsql.ToString(), null); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { int id = Convert.ToInt32(dr["id"]); //数据ID int user_id = Convert.ToInt32(dr["user_id"]); //申请用户 string master = dr["master"].ToString(); //核心字段的数据 work_follow_detail_waitting(item_function, id, user_id, master); } } //【已审核通知】 查询出所有状态为1或者2(审核通过,驳回)的数据 StringBuilder strsql1 = new StringBuilder(); strsql1.Append("select "); strsql1.Append(o.HO_ID_FIELD + " as id"); strsql1.Append("," + o.HO_USER_FIELD + " as user_id"); strsql1.Append("," + o.HO_MASTER_FIELD + " as master"); strsql1.Append("," + o.HO_STAUTS_FIELD + " as status"); strsql1.Append(" from " + o.HO_TABLE_NAME); strsql1.Append(" where " + o.HO_STAUTS_FIELD + " in (1,2)"); DataTable dt1 = GetDataTable(strsql1.ToString(), null); if (dt1.Rows.Count > 0) { foreach (DataRow dr1 in dt1.Rows) { int id = Convert.ToInt32(dr1["id"]); //数据ID int user_id = Convert.ToInt32(dr1["user_id"]); //申请用户 string master = dr1["master"].ToString(); int status = Convert.ToInt32(dr1["status"]); work_follow_detail_done(item_function, id, user_id, master, status); } } }
public PathData GetPath(GData d) { Grid grid = new Grid(); List <GridSquare> rPath = grid.FindPath(d); List <Point> allPts = new List <Point>(); PathData fPath = new PathData(); foreach (var gs in rPath) { allPts.Add(ToPoint(gs)); } fPath.path = allPts.ToArray(); return(fPath); }
// Update is called once per frame void Update() { GData northPoint = gs.getNorthPoint(); redPoint.transform.position = new Vector3(-(northPoint.getX() * 6 - 3), northPoint.getY() * 6 - 3, 0.0f); GData southPoint = gs.getSouthPoint(); bluePoint.transform.position = new Vector3(-(southPoint.getX() * 6 - 3), southPoint.getY() * 6 - 3, 0.0f); GData bipolarMidpoint = gs.getBipolarMidpoint(); midPoint.transform.position = new Vector3(-(bipolarMidpoint.getX() * 6 - 3), bipolarMidpoint.getY() * 6 - 3, 0.0f); midPoint.transform.rotation = Quaternion.Euler(0.0f, 0.0f, -bipolarMidpoint.getAngle() * Mathf.Rad2Deg); }
private void RadioButton2_CheckedChanged(object sender, EventArgs e) { if (init) { return; } GData.Config.UseLanguage = radioButton2.Checked; if (radioButton2.Checked) { ComboBox1_SelectedIndexChanged(null, null); } else { GData.Data = GData.LoadLanguageDataDefault(); GData.Config.SaveConfig(); } }
/// <summary> /// Returns the functional unit to be used on display: User prefered, default million btu or functional unit of the /// process in case of the database does not contains enough information to convert to one million btu /// </summary> /// <param name="data"></param> /// <param name="results"></param> /// <param name="producedResourceId"></param> /// <returns></returns> internal static LightValue GetPreferedVisualizationFunctionalUnit(GData data, Results results, int producedResourceId) { LightValue preferedFunctionalUnit; if (results.CustomFunctionalUnitPreference.enabled) { preferedFunctionalUnit = new LightValue(results.CustomFunctionalUnitPreference.Amount, results.CustomFunctionalUnitPreference.PreferredUnitExpression); } else if (data.ResourcesData[producedResourceId].CanConvertTo(DimensionUtils.ENERGY, new LightValue(1.0, results.BottomDim))) { preferedFunctionalUnit = new LightValue(1, "MJ"); } else { preferedFunctionalUnit = new LightValue(1.0, results.BottomDim); } return(preferedFunctionalUnit); }
public string get_work_form_waitting() { string function_code = Request["function_code"]; if (string.IsNullOrEmpty(function_code)) { return(new AjaxErrorResult("function_code不能为空").ToString()); } FunctionCode = Convert.ToInt32(function_code); SqlConnection cn_count = comm_fun.get_cn(); string count = "0"; try { StringBuilder str_count = new StringBuilder(); StringBuilder str_where = new StringBuilder(); H5Objects o = GData.GetObject(Convert.ToInt32(function_code)); List <SqlParameter> list_para = new List <SqlParameter>(); str_where.Append(" and " + o.HO_STAUTS_FIELD + " in (0,3) ");//待审核或者待终审 str_where.Append(" and " + o.HO_USER_FIELD + "=@" + o.HO_USER_FIELD); list_para.Add(new SqlParameter("@" + o.HO_USER_FIELD, Cookies.UserCode)); str_count.Append("select " + "count(1)" + " from " + o.HO_TABLE_NAME + " where 1=1 " + str_where); count = comm_fun.ExecuteScalar(str_count.ToString(), cn_count, list_para); } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); count = "0"; } finally { comm_fun.CloseConnection(cn_count); } if (Convert.ToInt32(count) > 99) { count = "99"; } return(new AjaxSuccessResult(count).ToString()); }
// Use this for initialization void Start() { ws = new WebSocket("ws://localhost:5100"); ws.OnOpen += (object sender, System.EventArgs e) => { wsConnected = true; }; ws.OnClose += (object sender, CloseEventArgs e) => { wsConnected = false; }; ws.OnMessage += (object sender, MessageEventArgs e) => { JSONObject data = new JSONObject(e.Data); northPoint = new GData(data["northPoint"]["x"].n, data["northPoint"]["y"].n, data["northPoint"]["intensity"].n, data["northPoint"]["angle"].n, data["northPoint"]["pitch"].n); southPoint = new GData(data["southPoint"]["x"].n, data["southPoint"]["y"].n, data["southPoint"]["intensity"].n, data["southPoint"]["angle"].n, data["southPoint"]["pitch"].n); bipolarMidpoint = new GData(data["bipolarMidpoint"]["x"].n, data["bipolarMidpoint"]["y"].n, data["bipolarMidpoint"]["intensity"].n, data["bipolarMidpoint"]["angle"].n, data["bipolarMidpoint"]["pitch"].n); tagID = new List <int>(); for (int i = 0; i < data["tagID"].Count; i++) { tagID.Add((int)data["tagID"][i].n); } }; }
public JsonResult FindPath(GData clientData) { GData data = new GData { blocked = clientData.blocked, blob = clientData.blob, target = clientData.target }; Debug.WriteLine("View from Home: " + "\nBlocked: " + data.blocked[0].x + ", " + data.blocked[0].y + "\nBlob: " + data.blob[0].x + ", " + data.blob[0].y + "\nTarget: " + data.target.x + ", " + data.target.y); PathData finalPath = new PathData { path = GetPath(data).path }; string myDebug = ""; foreach (var pt in finalPath.path) { myDebug = myDebug + pt.x + ", " + pt.y + "\n"; } Debug.WriteLine("The final path is: \n" + myDebug); return(Json(finalPath, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 1.1有审批结果的通知 /// </summary> public void work_follow_detail_done(int item_function, int id, int user, string master, int status) { //获取最后一条审批记录,WF_TIMES<100,通知用户然后WF_TIMES加上100 H5Objects o = GData.GetObject(item_function); IQueryable <SP_WORK_FOLLOW> list = null; list = db.SP_WORK_FOLLOW.Where(item => item.WF_BUSINESS_TYPE == o.HO_BUSINESS_TYPE); list = list.Where(item => item.WF_BUSINESS_KEY == id); list = list.Where(item => item.WF_STATUS == 1); list = list.Where(item => item.WF_TIMES < 100); if (list.ToList().Count > 0) { work_follow_end_notice_user(user, master, o.HO_NAME, status); foreach (SP_WORK_FOLLOW one_item in list.ToList()) { if (one_item != null) { one_item.WF_TIMES += 100; } } db.SaveChanges(); } }
/// <summary> /// Returns the functional unit to be used on display: User prefered, default million btu or functional unit of the /// process in case of the database does not contains enough information to convert to one million btu /// </summary> /// <param name="data"></param> /// <param name="results"></param> /// <param name="producedResourceId"></param> /// <returns></returns> internal static string GetPreferedVisualizationFunctionalUnitString(GData data, Results results, int producedResourceId) { string preferedFunctionalUnit = ""; try { if (results.CustomFunctionalUnitPreference.enabled) { preferedFunctionalUnit = results.CustomFunctionalUnitPreference.Amount.ToString() + " " + results.CustomFunctionalUnitPreference.PreferredUnitExpression; } else if (data.ResourcesData[producedResourceId].CanConvertTo(DimensionUtils.ENERGY, new LightValue(1.0, results.BottomDim))) { preferedFunctionalUnit = "1 MJ"; } else { AQuantity qty = Units.QuantityList.ByDim(results.BottomDim); preferedFunctionalUnit = "1 " + qty.SiUnit.Expression; } } catch { } return(preferedFunctionalUnit); }
/// <summary> /// Returns the functional unit to be used on display: User prefered, default million btu or functional unit of the /// process in case of the database does not contains enough information to convert to one million btu /// </summary> /// <param name="data"></param> /// <param name="results"></param> /// <param name="producedResourceId"></param> /// <returns></returns> internal static string GetPreferedVisualizationFunctionalUnitString(GData data, Results results, int producedResourceId) { string preferedFunctionalUnit = ""; try { if (results.CustomFunctionalUnitPreference.enabled) preferedFunctionalUnit = results.CustomFunctionalUnitPreference.Amount.ToString() + " " + results.CustomFunctionalUnitPreference.PreferredUnitExpression; else if (data.ResourcesData[producedResourceId].CanConvertTo(DimensionUtils.ENERGY, new LightValue(1.0, results.BottomDim))) preferedFunctionalUnit = "1 MJ"; else { AQuantity qty = Units.QuantityList.ByDim(results.BottomDim); preferedFunctionalUnit = "1 " + qty.SiUnit.Expression; } } catch { } return preferedFunctionalUnit; }
/// <summary> /// Returns the functional unit to be used on display: User prefered, default million btu or functional unit of the /// process in case of the database does not contains enough information to convert to one million btu /// </summary> /// <param name="data"></param> /// <param name="results"></param> /// <param name="producedResourceId"></param> /// <returns></returns> internal static LightValue GetPreferedVisualizationFunctionalUnit(GData data, Results results, int producedResourceId) { LightValue preferedFunctionalUnit; if (results.CustomFunctionalUnitPreference.enabled) preferedFunctionalUnit = new LightValue(results.CustomFunctionalUnitPreference.Amount, results.CustomFunctionalUnitPreference.PreferredUnitExpression); else if (data.ResourcesData[producedResourceId].CanConvertTo(DimensionUtils.ENERGY, new LightValue(1.0, results.BottomDim))) preferedFunctionalUnit = new LightValue(1, "MJ"); else preferedFunctionalUnit = new LightValue(1.0, results.BottomDim); return preferedFunctionalUnit; }
public string get_approve_work_form_list() { string function_code_list = Request["function_code_list"]; if (string.IsNullOrEmpty(function_code_list)) { return(new AjaxErrorResult("function_code_list不能为空").ToString()); } string type = Request["type"]; string page = Request["page"]; StringBuilder str_table = new StringBuilder(); StringBuilder str_table_column = new StringBuilder(); List <string> list = function_code_list.Split("_".ToCharArray()).ToList(); for (int i = 0; i < list.Count; i++) { string function_code = list[i]; H5Objects o = GData.GetObject(Convert.ToInt32(function_code)); List <H5Columns> list_column = GData.GetColumn(Convert.ToInt32(function_code)); if (i > 0) { str_table_column.Append(" union all "); } str_table_column.Append(" select "); str_table_column.Append(o.HO_ID_FIELD + " as id"); str_table_column.Append("," + o.HO_USER_FIELD + " as user_id"); str_table_column.Append(",dbo.fn_convert_datetime(" + o.HO_DATE_FIELD + ") as date"); str_table_column.Append("," + o.HO_STAUTS_FIELD + " as status"); str_table_column.Append("," + o.HO_MASTER_FIELD + " as master"); str_table_column.Append("," + o.HO_DATE_FIELD + " as create_date "); str_table_column.Append("," + o.HO_BUSINESS_TYPE + " as business"); str_table_column.Append("," + "'" + o.HO_NAME + "'" + " as business_text"); str_table_column.Append(" from " + o.HO_TABLE_NAME + ""); } str_table.Append("(" + str_table_column.ToString() + ") as sp_view"); //H5Objects o = GData.GetObject(Convert.ToInt32(function_code)); //List<H5Columns> list_column = GData.GetColumn(Convert.ToInt32(function_code)); List <SqlParameter> list_para = new List <SqlParameter>(); List <SqlParameter> list_para_count = new List <SqlParameter>(); StringBuilder strsql = new StringBuilder(); StringBuilder str_column = new StringBuilder(); StringBuilder str_where = new StringBuilder(); StringBuilder str_order = new StringBuilder(); StringBuilder str_count = new StringBuilder(); //我的发起 if (type == "me") { str_where.Append(" and user_id=@user_id"); list_para.Add(new SqlParameter("@user_id", Cookies.UserCode)); list_para_count.Add(new SqlParameter("@user_id", Cookies.UserCode)); } //我的审批 if (type == "other") { str_table.Append(" inner join SP_WORK_FOLLOW on WF_BUSINESS_TYPE=business and WF_BUSINESS_KEY=id "); str_where.Append(" and WF_TO_USER=@WF_TO_USER"); list_para.Add(new SqlParameter("@WF_TO_USER", Cookies.UserCode)); list_para_count.Add(new SqlParameter("@WF_TO_USER", Cookies.UserCode)); } str_order.Append(" order by create_date desc"); SqlConnection cn_count = comm_fun.get_cn(); string count = "0"; try { str_count.Append("select " + "count(1)" + " from " + str_table.ToString() + " where 1=1 " + str_where); count = comm_fun.ExecuteScalar(str_count.ToString(), cn_count, list_para_count); } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); count = "0"; } finally { comm_fun.CloseConnection(cn_count); } int SAO_PAGE_SIZE = 20; int SAO_CURRENT_PAGE = Convert.ToInt32(page); str_column.Append("id"); str_column.Append(",user_id"); str_column.Append(",date"); str_column.Append(",status"); str_column.Append(",master"); str_column.Append(",business"); str_column.Append(",business_text"); if (type == "other") { str_column.Append(",WF_STATUS"); } strsql.Append("select top " + SAO_PAGE_SIZE + " " + str_column.ToString() + " from " + str_table.ToString() + " where 1=1"); strsql.Append(" and id not in (select top " + (SAO_CURRENT_PAGE * SAO_PAGE_SIZE).ToString() + " id " + " from " + str_table.ToString() + " where 1=1 " + str_where.ToString() + " " + str_order.ToString() + ")" + str_where.ToString() + " " + str_order.ToString()); DataTable dt = new DataTable(); SqlConnection cn = comm_fun.get_cn(); try { dt = comm_fun.GetDatatable(strsql.ToString(), cn, list_para); if (dt.Rows.Count > 0) { dt.Columns.Add("user_name"); dt.Columns.Add("user_image"); dt.Columns.Add("status_name"); dt.Columns.Add("status_class"); foreach (DataRow dr in dt.Rows) { dr["user_name"] = get_user_name(dr["user_id"].ToString()); dr["user_image"] = GData.get_user_image(dr["user_id"].ToString()); dr["status_name"] = GData.get_status_name(dr["status"].ToString()); dr["status_class"] = GData.get_status_class(dr["status"].ToString()); } } } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); } if (dt.Rows.Count > 0) { return(new AjaxDataResult(dt).ToString()); } else { return(new AjaxErrorResult("").ToString()); } }
/// <summary> /// 1.2无审批结果的通知 /// </summary> public void work_follow_detail_waitting(int item_function, int id, int user, string master) { //0为没有任何提醒,1=10分钟后提示一次,2=4小时提示一次,n=每天9点提醒一次,n>5停止提醒,n=6通知申请客户 H5Objects o = GData.GetObject(item_function); IQueryable <SP_WORK_FOLLOW> list = null; list = db.SP_WORK_FOLLOW.Where(item => item.WF_BUSINESS_TYPE == o.HO_BUSINESS_TYPE); list = list.Where(item => item.WF_BUSINESS_KEY == id); list = list.Where(item => item.WF_STATUS == 0); //10分钟提醒 DateTime dt1 = DateTime.Now.AddMinutes(-10); IQueryable <SP_WORK_FOLLOW> list1 = list.Where(item => item.WF_CREATE_DATE < dt1 && item.WF_TIMES == 0); foreach (SP_WORK_FOLLOW item in list1.ToList()) { work_follow_star_notice_user(user, master, o.HO_NAME, item.WF_TO_USER); item.WF_TIMES = 1; } db.SaveChanges(); //4小时提醒 DateTime dt2 = DateTime.Now.AddHours(-4); IQueryable <SP_WORK_FOLLOW> list2 = list.Where(item => item.WF_CREATE_DATE < dt2 && item.WF_TIMES == 1); foreach (SP_WORK_FOLLOW item in list2.ToList()) { work_follow_star_notice_user(user, master, o.HO_NAME, item.WF_TO_USER); item.WF_TIMES = 2; } db.SaveChanges(); //n = 每天9点提醒一次,n > 5停止提醒 for (int i = 0; i < 3; i++) { if (DateTime.Now.Hour >= 9 && DateTime.Now.Hour <= 18) { DateTime dt_begin = Convert.ToDateTime(DateTime.Now.AddDays(-(i + 1)).ToString("yyyy-MM-dd")); DateTime dt_end = Convert.ToDateTime(DateTime.Now.AddDays(-i).ToString("yyyy-MM-dd")); IQueryable <SP_WORK_FOLLOW> listn = list.Where(item => item.WF_CREATE_DATE > dt_begin && item.WF_CREATE_DATE < dt_end && item.WF_TIMES == (2 + i)); foreach (SP_WORK_FOLLOW item in listn.ToList()) { work_follow_star_notice_user(user, master, o.HO_NAME, item.WF_TO_USER); item.WF_TIMES = item.WF_TIMES + 1; } db.SaveChanges(); } } //n = 6通知申请客户 DateTime dt6 = Convert.ToDateTime(DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd")); IQueryable <SP_WORK_FOLLOW> list6 = list.Where(item => item.WF_TIMES < 6); list6 = list6.Where(item => item.WF_CREATE_DATE < dt6); foreach (SP_WORK_FOLLOW item in list6.ToList()) { work_follow_stop_notice_user(user, master, o.HO_NAME, item.WF_TO_USER); item.WF_TIMES = 6; } db.SaveChanges(); }
public string handle_work_follow() { string function_code = Request["function_code"]; if (string.IsNullOrEmpty(function_code)) { return(new AjaxErrorResult("function_code不能为空").ToString()); } FunctionCode = Convert.ToInt32(function_code); string id = Request["id"]; if (string.IsNullOrEmpty(id)) { return(new AjaxErrorResult("id不能为空").ToString()); } int Id = Convert.ToInt32(id); string WF_STATUS = Request["WF_STATUS"]; if (string.IsNullOrEmpty(WF_STATUS)) { return(new AjaxErrorResult("WF_STATUS不能为空").ToString()); } string WF_REASON = Request["WF_REASON"]; if (string.IsNullOrEmpty(WF_REASON)) { WF_REASON = string.Empty; } string WF_TO_USER = Request["WF_TO_USER"]; H5Objects obj = H5Object; try { if (WF_STATUS == "1") { int to_user = 0; //审批通过 if (string.IsNullOrEmpty(WF_TO_USER)) { to_user = GData.get_administrator(obj.HO_BUSINESS_TYPE); } else { to_user = Convert.ToInt32(WF_TO_USER); } //普通审核(更新本数据,插入待审核数据) int my_id = Convert.ToInt32(Cookies.UserCode); //更新本数据 SP_WORK_FOLLOW one_work = db.SP_WORK_FOLLOW.Where(o => o.WF_BUSINESS_TYPE == obj.HO_BUSINESS_TYPE && o.WF_BUSINESS_KEY == Id && o.WF_TO_USER == my_id && (o.WF_STATUS == 0 || o.WF_STATUS == 3)).FirstOrDefault(); one_work.WF_STATUS = Convert.ToInt32(WF_STATUS); one_work.WF_REASON = WF_REASON; one_work.WF_APPROVE_DATE = DateTime.Now; //判断自己是否为终审人, if (GData.check_administrator(obj.HO_BUSINESS_TYPE, Cookies.UserCode)) { //更新状态为终审 update_form_status(Id, 1, FunctionCode); db.SaveChanges(); AjaxSuccessResult re = new AjaxSuccessResult("保存成功"); re.message = GData.get_status_name("1"); re.primary_key = "1"; return(re.ToString()); } else { //插入待审数据 SP_WORK_FOLLOW new_work = new SP_WORK_FOLLOW(); new_work.WF_BUSINESS_KEY = one_work.WF_BUSINESS_KEY; new_work.WF_BUSINESS_TYPE = one_work.WF_BUSINESS_TYPE; new_work.WF_CREATE_DATE = DateTime.Now; new_work.WF_FROM_USER = my_id; new_work.WF_STATUS = 0; new_work.WF_TO_USER = to_user; db.SP_WORK_FOLLOW.Add(new_work); //判断下一个审批人是否为终审人,是就改变状态为待终审 if (GData.check_administrator(obj.HO_BUSINESS_TYPE, to_user.ToString())) { update_form_status(Id, 3, FunctionCode); db.SaveChanges(); AjaxSuccessResult re = new AjaxSuccessResult(""); re.message = GData.get_status_name("3"); re.primary_key = "3"; return(re.ToString()); } else { db.SaveChanges(); AjaxSuccessResult re = new AjaxSuccessResult(""); re.message = GData.get_status_name("0"); re.primary_key = "0"; return(re.ToString()); } } } if (WF_STATUS == "2") { //驳回(更新本数据,更新主数据) //更新本数据 int my_id = Convert.ToInt32(Cookies.UserCode); SP_WORK_FOLLOW one_work = db.SP_WORK_FOLLOW.Where(o => o.WF_BUSINESS_TYPE == obj.HO_BUSINESS_TYPE && o.WF_BUSINESS_KEY == Id && o.WF_TO_USER == my_id && o.WF_STATUS == 0).FirstOrDefault(); one_work.WF_STATUS = Convert.ToInt32(WF_STATUS); one_work.WF_REASON = WF_REASON; one_work.WF_APPROVE_DATE = DateTime.Now; //更新主数据[驳回] update_form_status(Id, 2, FunctionCode); db.SaveChanges(); AjaxSuccessResult re = new AjaxSuccessResult("保存成功"); re.message = GData.get_status_name("2"); re.primary_key = "2"; return(re.ToString()); } if (WF_STATUS == "4") { //更新主数据[撤回] update_form_status(Id, 4, FunctionCode); AjaxSuccessResult re = new AjaxSuccessResult("保存成功"); re.message = GData.get_status_name("4"); re.primary_key = "4"; return(re.ToString()); } return(new AjaxSuccessResult("保存成功").ToString()); } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); return(new AjaxErrorResult("保存失败").ToString()); } }
public string get_work_form_list() { string function_code = Request["function_code"]; if (string.IsNullOrEmpty(function_code)) { return(new AjaxErrorResult("function_code不能为空").ToString()); } FunctionCode = Convert.ToInt32(function_code); string page = Request["page"]; if (string.IsNullOrEmpty(page)) { return(new AjaxErrorResult("page不能为空").ToString()); } H5Objects o = GData.GetObject(Convert.ToInt32(function_code)); List <H5Columns> list_column = GData.GetColumn(Convert.ToInt32(function_code)); List <SqlParameter> list_para = new List <SqlParameter>(); StringBuilder strsql = new StringBuilder(); StringBuilder str_column = new StringBuilder(); StringBuilder str_where = new StringBuilder(); StringBuilder str_order = new StringBuilder(); StringBuilder str_count = new StringBuilder(); str_where.Append(" and " + o.HO_USER_FIELD + "=@" + o.HO_USER_FIELD); str_order.Append(" order by " + o.HO_DATE_FIELD + " desc"); list_para.Add(new SqlParameter("@" + o.HO_USER_FIELD, Cookies.UserCode)); SqlConnection cn_count = comm_fun.get_cn(); string count = "0"; try { str_count.Append("select " + "count(1)" + " from " + o.HO_TABLE_NAME + " where 1=1 " + str_where); count = comm_fun.ExecuteScalar(str_count.ToString(), cn_count, list_para); } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); count = "0"; } finally { comm_fun.CloseConnection(cn_count); } int SAO_PAGE_SIZE = 20; int SAO_CURRENT_PAGE = Convert.ToInt32(page); str_column.Append(o.HO_ID_FIELD + " as id"); str_column.Append("," + o.HO_USER_FIELD + " as user_id"); str_column.Append(",dbo.fn_convert_datetime(" + o.HO_DATE_FIELD + ") as date"); str_column.Append("," + o.HO_STAUTS_FIELD + " as status"); str_column.Append("," + o.HO_MASTER_FIELD + " as master"); strsql.Append("select top " + SAO_PAGE_SIZE + " " + str_column.ToString() + " from " + o.HO_TABLE_NAME + " where 1=1"); strsql.Append(" and " + o.HO_ID_FIELD + " not in (select top " + (SAO_CURRENT_PAGE * SAO_PAGE_SIZE).ToString() + " " + o.HO_ID_FIELD + " " + " from " + o.HO_TABLE_NAME + " where 1=1 " + str_where.ToString() + " " + str_order.ToString() + ")" + str_where.ToString() + " " + str_order.ToString()); DataTable dt = new DataTable(); SqlConnection cn = comm_fun.get_cn(); try { dt = comm_fun.GetDatatable(strsql.ToString(), cn, list_para); if (dt.Rows.Count > 0) { dt.Columns.Add("user_name"); dt.Columns.Add("user_image"); dt.Columns.Add("status_name"); dt.Columns.Add("status_class"); foreach (DataRow dr in dt.Rows) { dr["user_name"] = get_user_name(dr["user_id"].ToString()); dr["user_image"] = GData.get_user_image(dr["user_id"].ToString()); dr["status_name"] = GData.get_status_name(dr["status"].ToString()); dr["status_class"] = GData.get_status_class(dr["status"].ToString()); } } } catch (Exception ex) { comm_fun.WriteLog(ex.ToString()); } if (dt.Rows.Count > 0) { return(new AjaxDataResult(dt).ToString()); } else { return(new AjaxErrorResult("").ToString()); } }
public string add_work_form() { string function_code = Request["function_code"]; if (string.IsNullOrEmpty(function_code)) { return(new AjaxErrorResult("function_code不能为空").ToString()); } H5Objects o = GData.GetObject(Convert.ToInt32(function_code)); List <H5Columns> list_column = GData.GetColumn(Convert.ToInt32(function_code)); StringBuilder strsql = new StringBuilder(); StringBuilder strsql_field = new StringBuilder(); StringBuilder strsql_para = new StringBuilder(); List <SqlParameter> list_para = new List <SqlParameter>(); foreach (H5Columns item_column in list_column) { strsql_field.Append("," + item_column.HC_NAME); strsql_para.Append(",@" + item_column.HC_NAME); list_para.Add(new SqlParameter("@" + item_column.HC_NAME, GetControlValue(item_column))); } strsql_field.Append("," + o.HO_USER_FIELD); strsql_para.Append(",@" + o.HO_USER_FIELD); list_para.Add(new SqlParameter("@" + o.HO_USER_FIELD, Cookies.UserCode)); strsql_field.Append("," + o.HO_DATE_FIELD); strsql_para.Append(",@" + o.HO_DATE_FIELD); list_para.Add(new SqlParameter("@" + o.HO_DATE_FIELD, DateTime.Now)); strsql_field.Append("," + o.HO_STAUTS_FIELD); strsql_para.Append(",@" + o.HO_STAUTS_FIELD); list_para.Add(new SqlParameter("@" + o.HO_STAUTS_FIELD, "0")); strsql.Append("insert into " + o.HO_TABLE_NAME); strsql.Append("(" + strsql_field.ToString().Substring(1) + ")"); strsql.Append("values"); strsql.Append("(" + strsql_para.ToString().Substring(1) + ")"); strsql.Append(" " + "select @ID=@@identity"); SqlParameter para_id = new SqlParameter("@ID", SqlDbType.Int, 8); para_id.Direction = ParameterDirection.Output; list_para.Add(para_id); SqlConnection cn = comm_fun.get_cn(); try { bool b_reslut = comm_fun.ExecuteNonQuery(strsql.ToString(), cn, list_para); if (b_reslut) { int id = Convert.ToInt32(para_id.Value); add_work_follow(Convert.ToInt32(Cookies.UserCode), Convert.ToInt32(Request["to_user"]), Convert.ToInt32(function_code), id, string.Empty); return(new AjaxSuccessResult("保存成功" + id.ToString()).ToString()); } else { return(new AjaxErrorResult("执行失败").ToString()); } } catch { return(new AjaxExceptionResult("执行异常").ToString()); } finally { comm_fun.CloseConnection(cn); } }
public ActionResult Genetic(GData item) { item.Solve(); return(View(item)); }
public ActionResult GeneticGeneral(GData item) { item = gitem; item.Solve(); return(View("Genetic", item)); }