void Awake() { //transform_ = transform; //记录各功能按钮的展开状态下的位置 for (int i = 0; i < funtions_trans_.childCount; i++) { Transform info_trans = funtions_trans_.GetChild(i); Vector3 info_pos = info_trans.localPosition; Function_Info info = new Function_Info(info_trans, info_pos); function_info_list_.Add(info); } UIEventListener.Get(in_btn_object_).onClick = StrecthAllIn; UIEventListener.Get(out_btn_object_).onClick = StrecthAllOut; if (null != btn_object_) { //UIEventListener.Get(btn_object_).onClick = StrecthAll; } if (strecth_in_ > 0) { strecth_status_ = EStrecthStatus.StrecthStatus_Outed; StrecthAllIn(null); } else { strecth_status_ = EStrecthStatus.StrecthStatus_Ined; StrecthAllOut(null); } }
public static void SaveErrorLog(AMP_Rules rule, EventInfo evt, Function_Info finfo, Notification_Dep_user dep, int nPrevSnapshotId, int nCurrSnapshotId, string strFunctionName, string logText) { SqlConnection conn = new SqlConnection(strEBMSConn); try { conn.Open(); string strSQL = " insert into AMP_Error_Logs (RuleCode ,RuleName ,SnapshotPreviousId ,SnapshotCurrentId ,EventId ,Function_Id ,DepartmentCode ,DepartmentDesc ,Dep_User_Id ,EmailAddress ,RunDate ,Function_Name ,logMessage) "; strSQL += " values "; strSQL += " (@rulecode, @rulename,@prevsnapshotid, @currsnapshotid,@eventid, @functionid, @deptcode,@deptdesc, @deptuser, @emailaddress, @rundate,@funcname, @errmsg ) "; SqlCommand comm = new SqlCommand(strSQL, conn); comm.Parameters.Add("@rulecode", SqlDbType.VarChar, 20).Value = rule.RuleId; comm.Parameters.Add("@rulename", SqlDbType.VarChar, 255).Value = rule.Rule_Name; comm.Parameters.Add("@prevsnapshotid", SqlDbType.Int).Value = nPrevSnapshotId; comm.Parameters.Add("@currsnapshotid", SqlDbType.Int).Value = nCurrSnapshotId; comm.Parameters.Add("@eventid", SqlDbType.Int).Value = evt.EventId; if (finfo != null) { comm.Parameters.Add("@functionid", SqlDbType.Int).Value = finfo.FuncId; } else { comm.Parameters.Add("@functionid", SqlDbType.Int).Value = 0; } if (dep != null) { comm.Parameters.Add("@deptcode", SqlDbType.VarChar, 20).Value = dep.DepartmentCode; comm.Parameters.Add("@deptdesc", SqlDbType.VarChar, 255).Value = dep.DepartmentDesc; comm.Parameters.Add("@deptuser", SqlDbType.VarChar, 20).Value = dep.UserId; comm.Parameters.Add("@emailaddress", SqlDbType.VarChar, 200).Value = dep.EmailAddress; } else { comm.Parameters.Add("@deptcode", SqlDbType.VarChar, 20).Value = ""; comm.Parameters.Add("@deptdesc", SqlDbType.VarChar, 255).Value = ""; comm.Parameters.Add("@deptuser", SqlDbType.VarChar, 20).Value = ""; comm.Parameters.Add("@emailaddress", SqlDbType.VarChar, 200).Value = ""; } comm.Parameters.Add("@rundate", SqlDbType.DateTime).Value = DateTime.Now; comm.Parameters.Add("@funcname", SqlDbType.VarChar, 50).Value = strFunctionName; comm.Parameters.Add("@errmsg", SqlDbType.NText).Value = logText; comm.CommandTimeout = nCommandTimeOut; comm.ExecuteNonQuery(); } catch (Exception ex) { sendException(ex, "SaveErrorLog", "*****@*****.**", "*****@*****.**", "EBMS Amendment Runtime Error"); } finally { conn.Close(); } }
public void HideIconWhenIn() { if (strecth_status_ == EStrecthStatus.StrecthStatus_Ined || strecth_status_ == EStrecthStatus.StrecthStatus_Ining) { //隐藏各个功能按钮 for (int i = 0; i < funtions_trans_.childCount; i++) { Function_Info info = function_info_list_[i]; UIWidget[] widgets = info.fun_transform.GetComponentsInChildren <UIWidget>(); int wNum = widgets.Length; for (int j = 0; j < wNum; j++) { widgets[j].alpha = 0f; } } } }
void StrecthAllOut(GameObject go) { //strecth ined状态下,处理完相应操作后,才能改状态为strecth outing if (strecth_status_ == EStrecthStatus.StrecthStatus_Ined) { //隐蔽out按钮,显示in按钮 out_btn_object_.SetActive(false); in_btn_object_.SetActive(true); //显示各个功能按钮 for (int i = 0; i < funtions_trans_.childCount; i++) { Function_Info info = function_info_list_[i]; info.fun_transform.gameObject.SetActive(true); UIWidget[] widgets = info.fun_transform.GetComponentsInChildren <UIWidget>(); int wNum = widgets.Length; for (int j = 0; j < wNum; j++) { widgets[j].alpha = 1f; } } strecth_status_ = EStrecthStatus.StrecthStatus_Outing; } }
void Update() { int funtionnum = function_info_list_.Count; //0个功能按钮不用处理 if (funtionnum > 0) { //strecth ining状态下才能缩入 if (strecth_status_ == EStrecthStatus.StrecthStatus_Ining) { //按位移比例来移动 for (int i = 0; i < funtionnum; i++) { Function_Info info = function_info_list_[i]; info.fun_transform.Translate(-Time.deltaTime * info.fun_position * strecth_speed_); } Function_Info info0 = function_info_list_[0]; //当其中一个达到指定位置就改状态为strecth ined if ((right_side_ == 0 && info0.fun_transform.localPosition.x > 0 - strecth_cache_) || (right_side_ > 0 && info0.fun_transform.localPosition.x < strecth_cache_)) { //隐藏各个功能按钮 for (int i = 0; i < funtions_trans_.childCount; i++) { Function_Info info = function_info_list_[i]; UIWidget[] widgets = info.fun_transform.GetComponentsInChildren <UIWidget>(); int wNum = widgets.Length; for (int j = 0; j < wNum; j++) { widgets[j].alpha = 0f; } info.fun_transform.gameObject.SetActive(false); //移动时产生浮点误差,要调回正确位置 info.fun_transform.localPosition = new Vector3(0, 0, 0); } strecth_status_ = EStrecthStatus.StrecthStatus_Ined; } } //strecth outing状态下才能伸展 else if (strecth_status_ == EStrecthStatus.StrecthStatus_Outing) { //按位移比例来移动 for (int i = 0; i < funtionnum; i++) { Function_Info info = function_info_list_[i]; info.fun_transform.Translate(Time.deltaTime * info.fun_position * strecth_speed_); } Function_Info info0 = function_info_list_[0]; //当其中一个达到指定位置就改状态为strecth outed if ((right_side_ == 0 && info0.fun_transform.localPosition.x < info0.fun_position.x + strecth_cache_) || (right_side_ > 0 && info0.fun_transform.localPosition.x > info0.fun_position.x - strecth_cache_)) { //移动时产生浮点误差,要调回正确位置 for (int i = 0; i < funtions_trans_.childCount; i++) { Function_Info info = function_info_list_[i]; info.fun_transform.localPosition = info.fun_position; } strecth_status_ = EStrecthStatus.StrecthStatus_Outed; } } } }
public static void sendErrorException(string strEmailFrom, string strEmailTo, string strSubject, AMP_Rules rule, EventInfo evt, Function_Info finfo, Notification_Dep_user dep, int nPrevSnapshotId, int nCurrSnapshotId, string strFunctionName, string logText) { SaveErrorLog(rule, evt, finfo, dep, nPrevSnapshotId, nCurrSnapshotId, strFunctionName, logText); string strBody = ""; strBody = "There's error with function " + strFunctionName + ". <br/><br/> "; strBody = "Department: " + dep.DepartmentDesc + " (" + dep.DepartmentCode + ") <br/> "; strBody = "Department User: "******" /" + dep.EmailAddress + "<br/> "; strBody = "Rule: " + rule.Rule_Name + " (" + rule.RuleId + ") <br/> "; strBody = "Snapshot Previous:" + getSnapshotDateTimeFromId(nPrevSnapshotId) + " (" + nPrevSnapshotId.ToString() + ") <br/>"; strBody = "Snapshot Current:" + getSnapshotDateTimeFromId(nCurrSnapshotId) + " (" + nCurrSnapshotId.ToString() + ") <br/>"; strBody = "Event: " + evt.EventDesc + " (" + evt.EventId.ToString() + ") <br/>"; strBody = "Function: " + finfo.FuncDesc + " <br/><br/>"; strBody += "Error Messages:<br/> " + logText; AMP_Notification.sendEmail(strEmailFrom, strEmailTo, strSubject, strBody); }
private static EventAccountMessage checkOrder_Amendment(EventInfo evt, Function_Info finfo, Notification_Dep_user dep, int nCurrSnapshotId, int nPrevSnapshotId) { AMP_OrderDAL.dep = dep; AMP_OrderDAL.evt = evt; AMP_OrderDAL.finfo = finfo; AMP_OrderDAL.nSnapshotCurrentID = nCurrSnapshotId; AMP_OrderDAL.nSnapshotPreviousID = nPrevSnapshotId; EventAccountMessage order_amendment_msg = new EventAccountMessage(); List <Order_Info> lstCurrentOrders = AMP_OrderDAL.getCurrentFunctionOrders(); foreach (Order_Info ord in lstCurrentOrders) { AMP_OrderDAL.oinfo = ord; AMP_OrderDAL.getOrderHeader(); if (finfo.isOrdersChange) { AMP_OrderDAL.checkOrderChange(); } if (finfo.isOrdersNotesChange) { AMP_OrderDAL.checkOrderNotesChange(); } if (finfo.isOrderItemsChange) { AMP_OrderDAL.checkOrderItemChange(); } if (finfo.isOrderItemsNotesChange) { AMP_OrderDAL.checkOrderItemNotesChange(); } if (AMP_OrderDAL.eMsg.OrderUpdated) { order_amendment_msg.OrderUpdated = true; order_amendment_msg.MSGText += AMP_OrderDAL.eMsg.MSGText; order_amendment_msg.MSGHTML += AMP_OrderDAL.eMsg.MSGHTML; } } List <Order_Info> lstDelOrders = AMP_OrderDAL.getDeletedOrders(); foreach (Order_Info delord in lstDelOrders) { AMP_OrderDAL.oinfo = delord; AMP_OrderDAL.getOrderHeader(); AMP_OrderDAL.checkDeltedOrderItems(); if (AMP_OrderDAL.eMsg.OrderUpdated) { order_amendment_msg.OrderUpdated = true; order_amendment_msg.MSGText += AMP_OrderDAL.eMsg.MSGText; order_amendment_msg.MSGHTML += AMP_OrderDAL.eMsg.MSGHTML; } } return(order_amendment_msg); }