Esempio n. 1
0
        /// <summary>
        /// 获取流程类型和流程列表
        /// </summary>
        /// <param name="context"></param>
        private void getTypeAndFlowList(HttpContext context)
        {
            try
            {
                List <WorkFlow.Model.FLOW_TYPE> typelist = WorkFlow.BLL.Operate.getFlowType();     //获取所有流程类别

                List <WorkFlow.Model.FLOW_DEFINE> lclist = WorkFlow.BLL.Operate.getDefineList(""); //获取所有流程定义

                List <FlowTypeData>         list        = new List <FlowTypeData>();               //结构树
                Dictionary <string, string> list_define = CFunctions.getMyFlowDefine(context);     //当前登录人有权限的流程
                foreach (WorkFlow.Model.FLOW_TYPE type in typelist)
                {
                    List <WorkFlow.Model.FLOW_DEFINE> lclist_temp = lclist.Where(p => (p.TYPE_CODE == type.TYPE_CODE) && (list_define.ContainsKey(p.DEFINE_CODE))).ToList <WorkFlow.Model.FLOW_DEFINE>();
                    FlowTypeData ftd = new FlowTypeData();
                    ftd.type = type;
                    foreach (WorkFlow.Model.FLOW_DEFINE fdi in lclist_temp)
                    {
                        ftd.list.Add(fdi);
                    }
                    list.Add(ftd);
                }

                string json = JsonConvert.SerializeObject(list);
                context.Response.ContentType = "application/json";
                context.Response.Write(json);
                context.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                string json = JsonConvert.SerializeObject("{'IsSuccess':'false','Message':'服务器交互失败!'}");
                context.Response.ContentType = "application/json";
                context.Response.Write(json);
                context.ApplicationInstance.CompleteRequest();
            }
        }
 public CDiscoveredConfig()
 {
     if (Id == null)
     {
         Id = CFunctions.GenerateUID();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 发送申请单
        /// </summary>
        /// <param name="context"></param>
        private void sendTask(HttpContext context)
        {
            string json        = string.Empty;
            string TASK_CODE   = context.Request["TASK_CODE"];
            string DEFINE_CODE = context.Request["DEFINE_CODE"];

            try
            {
                WorkFlow.Model.FLOW_TASK model = WorkFlow.BLL.Operate.GetTask(TASK_CODE);
                if (model.STATUS != "0") //状态为0,启动流程
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"流程已经启动,无法再次启动!\"}";
                }
                else
                {
                    bool re = WorkFlow.BLL.Operate.StartFlow(TASK_CODE, DEFINE_CODE, CFunctions.getUserId(context), "");
                    if (re)
                    {
                        json = "{\"IsSuccess\":\"true\",\"Message\":\"发送成功!\"}";
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"发送失败!\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"" + ex.ToString() + "!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 4
0
        /// <summary>
        /// 添加申请单
        /// </summary>
        /// <param name="context"></param>
        private void addTask(HttpContext context)
        {
            string json = string.Empty;

            WorkFlow.Model.FLOW_TASK model = new WorkFlow.Model.FLOW_TASK();
            model.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
            model.DEFINE_CODE = context.Request["DEFINE_CODE"];
            model.TASK_CODE   = context.Request["TASK_CODE"];
            model.TASK_TILTE  = context.Request["TASK_TILTE"];
            model.STATUS      = context.Request["STATUS"];
            model.TASK_TYPE   = context.Request["TASK_TYPE"];
            model.ADD_EMP     = CFunctions.getUserId(context);//context.Request["ADD_EMP"];
            model.ADD_TIME    = DateTime.Now;
            model.TASK_JSON   = context.Request["TASK_JSON"];
            //model.ADD_EMP
            bool result = WorkFlow.BLL.Operate.AddTask(model);

            if (result)
            {
                json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
            }
            else
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 5
0
        private void getCount(HttpContext context)
        {
            string capitalaccounttype = context.Request["capitalaccounttype"].ToString();
            string organizationid     = context.Request["organizationid"].ToString();
            string sql  = "";
            string json = "";

            if (!string.IsNullOrEmpty(capitalaccounttype) && capitalaccounttype != "全部")
            {
                sql += " and capitalaccounttype='" + capitalaccounttype + "'";
            }

            if (!string.IsNullOrEmpty(organizationid))
            {
                organizationid = CFunctions.getChildByParentId(organizationid);
                sql           += " and organizationid in(" + organizationid + ")";
            }
            try
            {
                int count = countBll.GetCount(sql);
                json = "{\"IsSuccess\":\"true\",\"Count\":" + count + "}";
            }
            catch
            {
                json = "{\"IsSuccess\":\"false\",\"Count\":0}";
            }

            context.Response.ContentType = "application/json";
            //返回JSON结果
            context.Response.Write(json);
            context.Response.End();
        }
Esempio n. 6
0
        /// <summary>
        /// 初始化方法,根据itemname和dbtype获取数据库连接字符串,并决定初始化哪一种数据处理helper
        /// </summary>
        /// <param name="itemname">节点的名称</param>
        /// <param name="dbtype"></param>
        /// <returns></returns>
        public bool init(string itemname, string dbtype)
        {
            //if (sqlHelper == null) {

            string conn = CFunctions.getConfigName(itemname, dbtype);

            if (dbtype.ToUpper().Contains("SQLSERVER"))
            {
                sqlHelper = new SqlDbHelper(conn);
                return(true);
            }
            else if (dbtype.ToUpper().Contains("ORACLE"))
            {
                sqlHelper = new OraDbHelper(conn);
                return(true);
            }
            else if (dbtype.ToUpper().Contains("MYSQL"))
            {
                sqlHelper = new MySqlDbHelper(conn);
                return(true);
            }
            return(false);



            // }
            // return true;
        }
Esempio n. 7
0
        public System.Data.DataTable GetTableByProc(string ProcName, CmdParameter[] parms)
        {
            MySqlParameter[] pas = CFunctions.ConvertToMySqlParameter(parms);
            DataTable        dt  = new DataTable();

            using (MySqlConnection conn = new MySqlConnection(strConn))
            {
                using (MySqlDataAdapter da = new MySqlDataAdapter(ProcName, conn))
                {
                    try
                    {
                        da.SelectCommand.CommandType = CommandType.StoredProcedure;
                        if (pas != null)
                        {
                            da.SelectCommand.Parameters.AddRange(pas);
                        }
                        dt.TableName = ProcName;
                        da.Fill(dt);
                        da.SelectCommand.Parameters.Clear();
                    }
                    catch (Exception ex)
                    {
                        CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name + ":" + ProcName, ex);
                        throw (ex);
                    }
                }
            }

            return(dt);
        }
Esempio n. 8
0
        private void getPageList(HttpContext context)
        {
            //try
            //{
            //    string strUser = ((FormsIdentity)context.User.Identity).Ticket.UserData;
            //    TBL_USER user = JsonConvert.DeserializeObject<TBL_USER>(strUser);
            //}
            //catch (Exception e)
            //{

            //    throw;
            //}
            string json       = string.Empty;
            string sql        = "  and a.username <>'admin' ";
            int    pcount     = 0;
            int    totalcount = 0;
            // string strUser = ((FormsIdentity)context.User.Identity).Ticket.UserData;
            string username       = context.Request["username"];
            string role           = context.Request["role"];
            string organizationid = context.Request["organizationid"];
            string job            = context.Request["job"];

            if (!string.IsNullOrEmpty(username))
            {
                sql += " and  name like '%" + username + "%' ";
            }

            if (!string.IsNullOrEmpty(role))
            {
                sql += " and  d.roleid='" + role + "' ";
            }

            if (!string.IsNullOrEmpty(organizationid))
            {
                string Organization = CFunctions.getChildByParentId(organizationid);
                sql += " and b.organizationid in(" + Organization + ")";
                // sql += " and  b.organizationid  = '" + organizationid + "' ";
            }

            if (!string.IsNullOrEmpty(job))
            {
                sql += " and  a.job  like '%" + job + "%' ";
            }

            try
            {
                Dictionary <string, object> users = userBLL.GetPageList(sql, sort, page, rows, out pcount, out totalcount);
                json = JsonConvert.SerializeObject(users);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                json = JsonConvert.SerializeObject("{IsSuccess:'false',Message:'服务器交互失败!'}");
            }

            context.Response.ContentType = "application/json";
            //返回JSON结果
            context.Response.Write(json);
            context.Response.End();
        }
Esempio n. 9
0
        /// <summary>
        /// 执行非查询存储过程和SQL语句
        /// 增、删、改
        /// </summary>
        /// <param name="strSQL">要执行的SQL语句</param>
        /// <param name="paras">参数列表,没有参数填入null</param>
        /// <param name="cmdType">Command类型</param>
        /// <returns>返回影响行数</returns>
        public int ExcuteSQL(string strSQL, MySqlParameter[] paras, CommandType cmdType)
        {
            int i = 0;

            using (MySqlConnection conn = new MySqlConnection(strConn))
            {
                conn.Open();
                using (MySqlTransaction trans = conn.BeginTransaction())
                {
                    using (MySqlCommand cmd = new MySqlCommand(strSQL, conn))
                        try
                        {
                            cmd.CommandType = cmdType;
                            if (paras != null)
                            {
                                cmd.Parameters.AddRange(paras);
                            }
                            cmd.Transaction = trans;
                            //  conn.Open();
                            i = cmd.ExecuteNonQuery();
                            trans.Commit();
                            conn.Close();
                        }
                        catch (Exception ex)
                        {
                            CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                            trans.Rollback();
                            throw (ex);
                        }
                }
            }
            return(i);
        }
Esempio n. 10
0
        static internal string CheckPortStatus(IPAddress ip, ushort port)
        {
            string error       = "";
            string strLocalIPs = "";
            bool   skip        = false;

            // check if ip address is local if so skip this step
            IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());

            foreach (IPAddress localIP in localIPs)
            {
                strLocalIPs += localIP.ToString() + ", ";
                if (localIP.Equals(ip))
                {
                    skip = true;
                }
            }

            if (!skip)
            {
                Log.Write(CFunctions.StringReplace("Checking ports before logon. Connecting to remote machine ({0}) from local machine with addresses ({1}).", ip.ToString(), strLocalIPs), Log.Verbosity.Debug);
                using (TcpClient client = new TcpClient())
                {
                    var result  = client.BeginConnect(ip, port, null, null);
                    var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromMilliseconds(COptions.Connection_Timeout), true);
                    if (!success)
                    {
                        error = CFunctions.StringReplace("A connection timeout occurred, make sure {0}:{1} is available.", ip.ToString(), port.ToString());
                    }
                }
            }
            return(error);
        }
Esempio n. 11
0
        public void RotationTest()
        {
            using (var obj = new GKAgent3D()) {
                var initial = new Matrix3(0, 0, 1,
                                          0, 1, 0,
                                          1, 0, 0);
                Asserts.AreEqual(initial, obj.Rotation, "Rotation");
                Asserts.AreEqual((MatrixFloat3x3)initial, obj.Rotation3x3, "Rotation3x3");

                var mat = new Matrix3(1, 2, 3,
                                      4, 5, 6,
                                      7, 8, 9);
                var mat3x3 = (MatrixFloat3x3)mat;

                obj.Rotation = mat;
                Asserts.AreEqual(mat, obj.Rotation, "Rotation after setter");
                var transposed3x3 = MatrixFloat3x3.Transpose((MatrixFloat3x3)mat);
                Asserts.AreEqual(transposed3x3, obj.Rotation3x3, "Rotation3x3 after setter");
                Asserts.AreEqual(transposed3x3, CFunctions.GetMatrixFloat3x3(obj, "rotation"), "Rotation3x3 after setter native");

                obj.Rotation3x3 = mat3x3;
                Asserts.AreEqual(mat3x3, obj.Rotation3x3, "Rotation3x3 after setter 3x3");
                Asserts.AreEqual(mat3x3, CFunctions.GetMatrixFloat3x3(obj, "rotation"), "Rotation3x3 after setter native 3x3");
            }
        }
Esempio n. 12
0
        public int ExecuteSqlTran(List <string> SQLStringList)
        {
            using (MySqlConnection conn = new MySqlConnection(strConn))
            {
                conn.Open();
                using (MySqlTransaction trans = conn.BeginTransaction())
                {
                    MySqlCommand cmd = new MySqlCommand();
                    try
                    {
                        //循环
                        foreach (string sql in SQLStringList)
                        {
                            cmd.CommandText = sql;
                            cmd.ExecuteNonQuery();
                            int val = cmd.ExecuteNonQuery();
                            // cmd.Parameters.Clear();
                        }
                        trans.Commit();

                        return(1);
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                        return(0);
                        //throw;
                    }
                }
            }
        }
Esempio n. 13
0
        public void Create()
        {
            var M2x2 = new MatrixFloat2x2(1, 2, 3, 4);
            var M3x3 = new MatrixFloat3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
            var M4x4 = new MatrixFloat4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);

            using (var obj = SKUniform.Create("name", M2x2)) {
                Asserts.AreEqual(M2x2, obj.MatrixFloat2x2Value, "11 MatrixFloat2x2Value");
                Asserts.AreEqual(M2x2, CFunctions.GetMatrixFloat2x2(obj, "matrixFloat2x2Value"), "11b MatrixFloat2x2Value");
                var tmp2 = new MatrixFloat2x2(9, 8, 7, 6);
                obj.MatrixFloat2x2Value = tmp2;
                Asserts.AreEqual(tmp2, obj.MatrixFloat2x2Value, "11 MatrixFloat2x2Value second");
                Asserts.AreEqual(tmp2, CFunctions.GetMatrixFloat2x2(obj, "matrixFloat2x2Value"), "11b MatrixFloat2x2Value second");
            }

            using (var obj = SKUniform.Create("name", M3x3)) {
                Asserts.AreEqual(M3x3, obj.MatrixFloat3x3Value, "12 MatrixFloat3x3Value");
                Asserts.AreEqual(M3x3, CFunctions.GetMatrixFloat3x3(obj, "matrixFloat3x3Value"), "12b MatrixFloat3x3Value");
                var tmp3 = new MatrixFloat3x3(9, 8, 7, 6, 5, 4, 3, 2, 1);
                obj.MatrixFloat3x3Value = tmp3;
                Asserts.AreEqual(tmp3, obj.MatrixFloat3x3Value, "12 MatrixFloat3x3Value second");
                Asserts.AreEqual(tmp3, CFunctions.GetMatrixFloat3x3(obj, "matrixFloat3x3Value"), "12b MatrixFloat3x3Value second");
            }

            using (var obj = SKUniform.Create("name", M4x4)) {
                Asserts.AreEqual(M4x4, obj.MatrixFloat4x4Value, "13  MatrixFloat4x4Value");
                Asserts.AreEqual(M4x4, CFunctions.GetMatrixFloat4x4(obj, "matrixFloat4x4Value"), "13b FloatMatrix4Value");
                var tmp4 = new MatrixFloat4x4(9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6);
                obj.MatrixFloat4x4Value = tmp4;
                Asserts.AreEqual(tmp4, obj.MatrixFloat4x4Value, "13 MatrixFloat4x4Value second");
                Asserts.AreEqual(tmp4, CFunctions.GetMatrixFloat4x4(obj, "matrixFloat4x4Value"), "13b MatrixFloat4x4Value second");
            }
        }
Esempio n. 14
0
        private void getList(HttpContext context)
        {
            //1.获取前端的参数
            string capitalaccounttype = context.Request["capitalaccounttype"].ToString();
            string organizationid     = context.Request["organizationid"].ToString();
            string sql  = " ";
            string json = "";

            if (!string.IsNullOrEmpty(capitalaccounttype) && capitalaccounttype != "全部")
            {
                sql += " and A.capitalaccounttype='" + capitalaccounttype + "'";
            }
            if (!string.IsNullOrEmpty(organizationid))
            {
                organizationid = CFunctions.getChildByParentId(organizationid);
                sql           += " and A.organizationid in(" + organizationid + ")";
            }
            int count   = 0;
            int tocount = 0;
            Dictionary <string, object> obj = countBll.GetPageListL(sql, sort + " " + order, page, rows, out count, out tocount);

            if (obj != null)
            {
                json = JsonConvert.SerializeObject(obj);
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 15
0
        public void RotationMatrix()
        {
            using (var obj = new SKTransformNode()) {
                var zero = new MatrixFloat3x3();
                obj.RotationMatrix = zero;
                // In Swift, a rotated zero matrice also becomes the identity matrice.
                Asserts.AreEqual(MatrixFloat3x3.Identity, obj.RotationMatrix, "RotationMatrix");
                // Changing XRotation (or YRotation for that matter), makes the RotationMatrix change too
                obj.XRotation = (nfloat)(Math.PI / 2);
                var rotatedMatrix = new MatrixFloat3x3(
                    1, 0, 0,
                    0, 0, -1,
                    0, 1, 0
                    );
                Asserts.AreEqual(rotatedMatrix, obj.RotationMatrix, 0.000001f, "RotationMatrix a");
                Asserts.AreEqual(rotatedMatrix, CFunctions.GetMatrixFloat3x3(obj, "rotationMatrix"), 0.000001f, "RotationMatrix native a");

                // Got this matrix after setting both XRotation and YRotation to Pi/2
                rotatedMatrix = new MatrixFloat3x3(
                    0, 1, 0,
                    0, 0, -1,
                    -1, 0, 0
                    );
                obj.RotationMatrix = rotatedMatrix;
                Asserts.AreEqual(rotatedMatrix, obj.RotationMatrix, 0.000001f, "RotationMatrix b");
                Assert.AreEqual((nfloat)(Math.PI / 2), obj.XRotation, 0.000001f, "XRotation b");
                Assert.AreEqual(0, obj.YRotation, 0.000001f, "YRotation b");                  // Setting YRotation changes RotationMatrix, but setting RotationMatrix doesn't change YRotation.
            }
        }
        public bool ShortcutValidator(SRValidator aValidator, ushort aKeyCode, NSEventModifierMask aFlags, out string outReason)
        {
            outReason = string.Empty;

            var recorder = View.Window.FirstResponder as SRRecorderControl;

            if (recorder == null)
            {
                return(false);
            }

            var shortcut = CFunctions.SRShortcutWithCocoaModifierFlagsAndKeyCode(aFlags, aKeyCode);

            if (IsTaken(pingShortcutRecorder, shortcut) ||
                IsTaken(globalPingShortcutRecorder, shortcut) ||
                IsTaken(pingItemShortcutRecorder, shortcut))
            {
                outReason = "it's already used. To use this shortcut, first remove or change the other shortcut";
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 17
0
        public void GetRotationMatrixTest()
        {
#if NET
            var matrix = NMatrix4.Identity;
#else
            var matrix = Matrix4.Identity;
#endif
            var V3 = new Vector3(1, 0, 0);

            using (var obj = new MDLTransform(matrix)) {
                obj.SetRotation(V3, 0);
                var expected = new MatrixFloat4x4(
                    1, 0, 0, 0,
                    0, (float)Math.Cos(1.0f), (float)-Math.Sin(1.0f), 0,
                    0, (float)Math.Sin(1.0f), (float)Math.Cos(1.0f), 0,
                    0, 0, 0, 1
                    );
#if NET
                Asserts.AreEqual(expected, obj.GetRotationMatrix(0), 0.00001f, "GetRotationMatrix");
#else
                Asserts.AreEqual((Matrix4)MatrixFloat4x4.Transpose(expected), obj.GetRotationMatrix(0), 0.00001f, "GetRotationMatrix");
                Asserts.AreEqual(expected, obj.GetRotationMatrix4x4(0), 0.00001f, "GetRotationMatrix4x4");
#endif
                Asserts.AreEqual(expected, CFunctions.MDLTransform_GetRotationMatrix(obj, 0), 0.00001f, "GetRotationMatrix4x4 native");
            }
        }
Esempio n. 18
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            var props   = new NSDictionary();
            var options = new NSDictionary();

            var url = NSBundle.MainBundle.GetUrlForResource("main", "jsbundle");

            //var url = NSUrl.FromString("http://localhost:8081/index.bundle?platform=ios");

            CFunctions.RCTRegisterModule(ObjCRuntime.Class.GetHandle(typeof(ToastExampleModule)));
            CFunctions.RCTRegisterModule(ObjCRuntime.Class.GetHandle(typeof(RandomNumberModule)));
            CFunctions.RCTRegisterModule(ObjCRuntime.Class.GetHandle(typeof(EventsModule)));

            RCTRootView rootView = new RCTRootView(url, new NSString("MyReactNativeApp"), props, options);
            var         vc       = new UIViewController();

            vc.View = rootView;

            Window.RootViewController = vc;

            // make the window visible
            Window.MakeKeyAndVisible();

            return(true);
        }
Esempio n. 19
0
 public double CalculateDistance(Coordinate p1, Coordinate p2)
 {
     return(CFunctions.BMKMetersBetweenMapPoints(
                CFunctions.BMKMapPointForCoordinate(p1.ToNative()),
                CFunctions.BMKMapPointForCoordinate(p2.ToNative())
                ));
 }
Esempio n. 20
0
        private void getContainer(HttpContext context)
        {
            //1.获取参数
            string json           = "";
            string organizationid = context.Request["organizationid"].ToString() == "全部" ? "" : context.Request["organizationid"].ToString();
            //2.t_sql语句
            string sql  = " select SUM(amount) amount,CONVERT(varchar(7),appeardate,120) appeardate from tbl_capitalaccount_flowrecord  where flowrecordtype='入账'  and CONVERT(varchar(4),appeardate,120)='" + DateTime.Now.Year + "'";
            string sql1 = " select SUM(amount) amount,CONVERT(varchar(7),appeardate,120) appeardate from tbl_capitalaccount_flowrecord  where flowrecordtype='出账'  and CONVERT(varchar(4),appeardate,120)='" + DateTime.Now.Year + "'";

            if (!string.IsNullOrEmpty(organizationid))
            {
                string organization = CFunctions.getChildByParentId(organizationid);
                sql  += " and organizationid in(" + organization + ")";
                sql1 += " and organizationid in(" + organizationid + ")";
            }
            sql  += " group by CONVERT(varchar(7),appeardate,120) ORDER BY appeardate";
            sql1 += " group by CONVERT(varchar(7),appeardate,120) ORDER BY appeardate";
            IList <MODEL.Capital.TBL_CAPITALACCOUNT_FLOWRECORD> flowList  = flowBll.GetListByOrgan(sql);
            IList <MODEL.Capital.TBL_CAPITALACCOUNT_FLOWRECORD> flowList1 = flowBll.GetListByOrgan(sql1);
            Dictionary <string, object> obj = new Dictionary <string, object>();

            //int days = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
            // obj.Add("total", days);
            obj.Add("rows", flowList);
            //obj.Add("total1", days);
            obj.Add("rows1", flowList1);
            json = JsonConvert.SerializeObject(obj);
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 21
0
        private void getCount(HttpContext context)
        {
            //1. 获取前端参数
            string flowrecordtype = context.Request["flowrecordtype"].ToString();
            string source         = context.Request["source"].ToString();
            string organization   = "";

            if (context.Request["Oneself"].ToString() == "1")
            {
                string   strUser = ((FormsIdentity)context.User.Identity).Ticket.UserData;
                TBL_USER user    = JsonConvert.DeserializeObject <TBL_USER>(strUser);
                organization = user.organizationid;
            }
            else
            {
                organization = context.Request["Organization"].ToString();
            }

            string appeardate = context.Request["StartTime"].ToString();
            string endDate    = context.Request["EndTime"].ToString();
            string sql        = "";
            string json       = "";

            if (!string.IsNullOrEmpty(flowrecordtype) && flowrecordtype != "全部")
            {
                sql += " and  flowrecordtype='" + flowrecordtype + "'";
            }
            if (!string.IsNullOrEmpty(source) && source != "全部")
            {
                sql += " and  source='" + source + "'";
            }
            if (!string.IsNullOrEmpty(organization) && organization != "全部")
            {
                organization = CFunctions.getChildByParentId(organization);
                sql         += " and organizationid in(" + organization + ")";
            }
            if (!string.IsNullOrEmpty(appeardate))
            {
                sql += " and  Convert(varchar(10),appeardate,120)>='" + Convert.ToDateTime(appeardate) + "'";
            }
            if (!string.IsNullOrEmpty(endDate))
            {
                sql += " and  Convert(varchar(10),appeardate,120)<='" + Convert.ToDateTime(endDate) + "'";
            }
            try
            {
                int count = flowBll.GetCount(sql);
                json = "{\"IsSuccess\":\"true\",\"Count\":" + count + "}";
            }
            catch
            {
                json = "{\"IsSuccess\":\"false\",\"Count\":0}";
            }

            context.Response.ContentType = "application/json";
            //返回JSON结果
            context.Response.Write(json);
            context.Response.End();
        }
Esempio n. 22
0
        private void getMyHandledTask(HttpContext context)
        {
            string json = CFunctions.getMyHandledTask(context);

            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 23
0
        public void CFunction()
        {
            Assert.AreEqual(42, CFunctions.theUltimateAnswer(), "a");
#if !__MACOS__
            Assert.AreEqual(42, CFunctions.object_theUltimateAnswer(), "object");
            Assert.AreEqual(42, CFunctions.ar_theUltimateAnswer(), "ar");
#endif
        }
Esempio n. 24
0
        public static void Main(string[] args)
        {
            //#if !DEBUG
            System.AppDomain.CurrentDomain.UnhandledException += CExceptionHandler.UnhandledExceptionTrapper;
            //#endif
            _StartTime = CFunctions.GetDateTime();

            foreach (string arg in args)
            {
                _Arguments += arg + ", ";
            }

            Log.Write(new String('=', 78), -2);
            Log.Write("{", -2);
            Log.Write("  Executable: " + _Executable.Substring(_Executable.LastIndexOf('\\') + 1), -2);

            Log.Write("  Arguments: " + _Arguments, -2);
            Log.Write("  Product version: " + ProductVersion, -2);
            Log.Write("  Product build: " + ProductBuild, -2);


            var    OSName    = Registry.GetValue(_WinRegistry, "ProductName", "");
            var    OSVersion = Registry.GetValue(_WinRegistry, "CurrentVersion", "");
            var    OSBuild   = Registry.GetValue(_WinRegistry, "CurrentBuild", "");
            object OSRelease; try { OSRelease = Registry.GetValue(_WinRegistry, "ReleaseId", ""); } catch { OSRelease = null; }

            if (OSRelease != null)
            {
                OSBuild += OSBuild + "." + OSRelease;
            }

            var OSBuildLabEx = Registry.GetValue(_WinRegistry, "BuildLabEx", "");

            Log.Write("  OS version: " + OSName + " " + OSVersion + "." + OSBuild, -2);
            Log.Write("  OS build: " + OSBuildLabEx, -2);
            Log.Write("  User locale: " + Thread.CurrentThread.CurrentCulture.Name + ", OS locale: " + CultureInfo.InstalledUICulture, 2);
            Log.Write("}", -2);

            // ignore invalid SSL errors, warn user in logs (might move up higher in code later on)
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
            ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
                                                                                System.Security.Cryptography.X509Certificates.X509Chain chain,
                                                                                System.Net.Security.SslPolicyErrors sslPolicyErrors)
            {
                if (sslPolicyErrors != System.Net.Security.SslPolicyErrors.None)
                {
                    Log.Write("Warning: A non-critical SSL error occurred: " + sslPolicyErrors);
                }
                return(true); // **** Always accept
            };

            //if (args.Length <= 0)
            //{
            _App = new App();
            _App.InitializeComponent();
            _App.Run();
            //}
        }
Esempio n. 25
0
 // Lấy thông tin mô tả của file
 private void LayThongTinMoTa(FileStream fs, int iSizeCount, int iSizeKeyword, int iSizePosition,
                              out int iCount, out int iKeyword, out int iPosition)
 {
     byte[] temp = new byte[iSizeCount + iSizeKeyword + iSizePosition];
     fs.Read(temp, 0, temp.Length);
     iCount    = CFunctions.GetInt(temp, 0, iSizeCount);
     iKeyword  = CFunctions.GetInt(temp, iSizeCount, iSizeKeyword);
     iPosition = CFunctions.GetInt(temp, iSizeCount + iSizeKeyword, iSizePosition);
 }
Esempio n. 26
0
        internal List <EntityViewBase> FindDatastores()
        {
            List <EntityViewBase> FoundEntities = new List <EntityViewBase> {
            };

            foreach (HostSystem host in GetHostCached().Values)
            {
                // only get information about mounted logical volumes
                foreach (ManagementObject r in (new ManagementObjectSearcher(host.Scopes["CIMV2"], new ObjectQuery("SELECT * FROM Win32_Volume WHERE drivetype='3' AND NOT name LIKE '%?%'"))).Get())
                {
                    Datastore ds   = null;
                    string    dsid = r.GetPropertyValue("DeviceId").ToString();
                    ds = GetDatastoreDiskCached(dsid);

                    bool dsalreadyfound = false;
                    foreach (Datastore entity in FoundEntities)
                    {
                        if (entity.ID == ds.ID)
                        {
                            dsalreadyfound = true; break;
                        }
                    }

                    ds.Name = r.GetPropertyValue("Name").ToString();
                    long blocksize = 0, capacity = 0, freespace = 0;
                    Int64.TryParse(r.GetPropertyValue("BlockSize").ToString(), out blocksize);
                    Int64.TryParse(r.GetPropertyValue("Capacity").ToString(), out capacity);
                    Int64.TryParse(r.GetPropertyValue("FreeSpace").ToString(), out freespace);
                    ds.BlockSize  = blocksize;
                    ds.Capacity   = capacity;
                    ds.FreeSpace  = freespace;
                    ds.FileSystem = r.GetPropertyValue("FileSystem").ToString();
                    List <string> owners = new List <string> {
                    };
                    if (ds.IsClustered)
                    {
                        foreach (HostSystem h in GetHostCached().Values)
                        {
                            owners.Add(h.Name);
                        }
                    }
                    else
                    {
                        owners.Add(host.Name);
                    }
                    ds.Cluster = _ClusterName;
                    ds.Host    = CFunctions.StringJoin(";", owners);

                    if (!dsalreadyfound)
                    {
                        FoundEntities.Add(ds);
                    }
                }
            }
            return(FoundEntities);
        }
Esempio n. 27
0
        private void getList(HttpContext context)
        {
            //1. 获取前端参数
            string flowrecordtype = context.Request["flowrecordtype"].ToString();
            string source         = context.Request["source"].ToString();
            string organization   = "";

            if (context.Request["Oneself"].ToString() == "1")
            {
                string   strUser = ((FormsIdentity)context.User.Identity).Ticket.UserData;
                TBL_USER user    = JsonConvert.DeserializeObject <TBL_USER>(strUser);
                organization = user.organizationid;
            }
            else
            {
                organization = context.Request["Organization"].ToString();
            }
            string appeardate = context.Request["StartTime"].ToString();
            string endDate    = context.Request["EndTime"].ToString();
            string json       = "";

            string sql = " select A.flowrecordid,A.organizationid,A.capitalaccountid,A.flowrecordtype,A.amount,convert(varchar(11),A.appeardate,120) appeardate,A.processnumber,A.source,B.organizationname from tbl_capitalaccount_flowrecord A inner join  TBL_ORGANIZATION B ON(A.organizationid=B.organizationid)";

            if (!string.IsNullOrEmpty(flowrecordtype) && flowrecordtype != "全部")
            {
                sql += " and  flowrecordtype='" + flowrecordtype + "'";
            }
            if (!string.IsNullOrEmpty(source) && source != "全部")
            {
                sql += " and  source='" + source + "'";
            }
            if (!string.IsNullOrEmpty(organization) && organization != "全部")
            {
                organization = CFunctions.getChildByParentId(organization);
                sql         += " and A.organizationid in(" + organization + ")";
            }
            if (!string.IsNullOrEmpty(appeardate))
            {
                sql += " and  Convert(varchar(10),A.appeardate,120)>='" + Convert.ToDateTime(appeardate) + "'";
            }
            if (!string.IsNullOrEmpty(endDate))
            {
                sql += " and  Convert(varchar(10),A.appeardate,120)<='" + Convert.ToDateTime(endDate) + "'";
            }
            int count   = 0;
            int tocount = 0;
            IList <MODEL.Capital.TBL_CAPITALACCOUNT_FLOWRECORD> obj = flowBll.GetPageList(sql, sort + " " + order, page, rows, out count, out tocount);

            if (obj.Count > 0)
            {
                json = JsonConvert.SerializeObject(obj);
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Esempio n. 28
0
        public System.Data.DataTable GetTableByProc(string ProcName, ref CmdParameter[] parms)
        {
            MySqlParameter[] pas = CFunctions.ConvertToMySqlParameter(parms);
            DataTable        dt  = new DataTable();

            using (MySqlConnection conn = new MySqlConnection(strConn))
            {
                using (MySqlDataAdapter da = new MySqlDataAdapter(ProcName, conn))
                {
                    try
                    {
                        da.SelectCommand.CommandType = CommandType.StoredProcedure;
                        if (pas != null)
                        {
                            da.SelectCommand.Parameters.AddRange(pas);
                        }
                        dt.TableName = ProcName;
                        da.Fill(dt);
                        da.SelectCommand.Parameters.Clear();
                    }
                    catch (Exception ex)
                    {
                        CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name + ":" + ProcName, ex);
                        throw (ex);
                    }
                    try
                    {
                        conn.Open();
                        MySqlCommand cmd = new MySqlCommand();
                        cmd.Connection  = conn;
                        cmd.CommandText = ProcName;
                        cmd.CommandType = CommandType.StoredProcedure;
                        foreach (MySqlParameter sp in pas)
                        {
                            cmd.Parameters.Add(sp);
                        }

                        cmd.ExecuteNonQuery();

                        for (int i = 0; i < pas.Length; i++)
                        {
                            pas[i] = cmd.Parameters[i];
                        }
                        parms = CFunctions.RecoverParameter(pas);
                    }
                    catch (Exception ex)
                    {
                        CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                        // throw (ex);
                    }
                }
            }

            return(dt);
        }
Esempio n. 29
0
        public void ProjectionMatrix()
        {
            using (var obj = new MDLCamera()) {
                Assert.AreEqual(0.1f, obj.NearVisibilityDistance, 0.0001f, "NearVisibilityDistance");
                Assert.AreEqual(1000f, obj.FarVisibilityDistance, 0.0001f, "FarVisibilityDistance");
                Assert.AreEqual(54f, obj.FieldOfView, 0.0001f, "FieldOfView");
#if NET
                var initialProjectionMatrix = new NMatrix4(
                    1.308407f, 0, 0, 0,
                    0, 1.962611f, 0, 0,
                    0, 0, -1.0002f, -0.20002f,
                    0, 0, -1, 0
                    );
#else
                var initialProjectionMatrix = new Matrix4(
                    1.308407f, 0, 0, 0,
                    0, 1.962611f, 0, 0,
                    0, 0, -1.0002f, -1,
                    0, 0, -0.20002f, 0
                    );
#endif
                Asserts.AreEqual(initialProjectionMatrix, obj.ProjectionMatrix, 0.0001f, "Initial");
#if NET
                Asserts.AreEqual(initialProjectionMatrix, CFunctions.GetMatrixFloat4x4(obj, "projectionMatrix"), 0.0001f, "Initial native");
#else
                Asserts.AreEqual(MatrixFloat4x4.Transpose((MatrixFloat4x4)initialProjectionMatrix), obj.ProjectionMatrix4x4, 0.0001f, "Initial 4x4");
                Asserts.AreEqual(MatrixFloat4x4.Transpose((MatrixFloat4x4)initialProjectionMatrix), CFunctions.GetMatrixFloat4x4(obj, "projectionMatrix"), 0.0001f, "Initial native");
#endif

                obj.NearVisibilityDistance = 1.0f;
#if NET
                var modifiedProjectionMatrix = new NMatrix4(
                    1.308407f, 0, 0, 0,
                    0, 1.962611f, 0, 0,
                    0, 0, -1.002002f, -2.002002f,
                    0, 0, -1, 0
                    );
#else
                var modifiedProjectionMatrix = new Matrix4(
                    1.308407f, 0, 0, 0,
                    0, 1.962611f, 0, 0,
                    0, 0, -1.002002f, -1,
                    0, 0, -2.002002f, 0
                    );
#endif
                Asserts.AreEqual(modifiedProjectionMatrix, obj.ProjectionMatrix, 0.0001f, "Second");
#if NET
                Asserts.AreEqual(modifiedProjectionMatrix, CFunctions.GetMatrixFloat4x4(obj, "projectionMatrix"), 0.0001f, "Second native");
#else
                Asserts.AreEqual(MatrixFloat4x4.Transpose((MatrixFloat4x4)modifiedProjectionMatrix), obj.ProjectionMatrix4x4, 0.0001f, "Second 4x4");
                Asserts.AreEqual(MatrixFloat4x4.Transpose((MatrixFloat4x4)modifiedProjectionMatrix), CFunctions.GetMatrixFloat4x4(obj, "projectionMatrix"), 0.0001f, "Second native");
#endif
            }
        }
        public void MatrixTest()
        {
            var m4   = new Matrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
            var m4x4 = (MatrixFloat4x4)m4;

            using (var obj = new MDLTransform()) {
                // identity
                Asserts.AreEqual(Matrix4.Identity, obj.Matrix, "Initial identity");
                Asserts.AreEqual(MatrixFloat4x4.Identity, obj.GetMatrix4x4(), "Initial identity 4x4");
                Asserts.AreEqual(MatrixFloat4x4.Identity, CFunctions.GetMatrixFloat4x4(obj, "matrix"), "Initial identity native");

                // translate the transform somewhere
                obj.SetTranslation(new Vector3(2, 2, 2), 0);

                // the matrix should now be a translation matrix like this:
                //   1 0 0 0 2
                //   0 1 0 0 2
                //   0 0 1 0 2
                //   0 0 0 1 0
                // but since Matrix4 is transposed when compared to MatrixFloat4x4, we get this:

                Asserts.AreEqual(new Matrix4(
                                     1, 0, 0, 0,
                                     0, 1, 0, 0,
                                     0, 0, 1, 0,
                                     2, 2, 2, 1
                                     ), obj.Matrix, "Translated");

                // The 4x4 version is correct:
                Asserts.AreEqual(new Matrix4(
                                     1, 0, 0, 2,
                                     0, 1, 0, 2,
                                     0, 0, 1, 2,
                                     0, 0, 0, 1
                                     ), obj.GetMatrix4x4(), "Translated 4x4");

                // Let's set the matrix to something (different from the identity matrix)
                obj.Matrix = m4;

                // And the matrix resets to the identify matrix.
                Asserts.AreEqual(Matrix4.Identity, obj.Matrix, "After set_Matrix");

                // Translate again
                obj.SetTranslation(new Vector3(3, 3, 3), 0);

                // Set the matrix using a 4x4 matrix
                obj.SetMatrix4x4(m4x4);

                // And we still get the identity matrix back
                Asserts.AreEqual(MatrixFloat4x4.Identity, obj.GetMatrix4x4(), "After set_Matrix 2");
            }
        }