Example #1
0
        public static string Logtenant(string Score, int ObjId, string Room_Num, string PassT)
        {
            string result = "";
            //DataTable dt = Mydb.ExecuteReadertoDataTable("uspo_TenantLogin", new SqlParameter[] {new SqlParameter("@Score",Score),new SqlParameter("@ObjId", ObjId),new SqlParameter("@Room_Num", Room_Num) }, CommandType.StoredProcedure);
            //foreach (DataRow item in dt.Rows)
            //{
            //    result= "{\"result\" : \"" + item["Result"] + "\"}";
            //}
            int RoomCount = (int)Mydb.ExecuteScalar("select COUNT (*) from ROOM where ROOM_NUMBER=@Room_Num and ROOM_ID=(select ROOM_ID from PER_SCORE where SCORE_ID=@Score and OBJECT_ID=@ObjId)", new SqlParameter[] { new SqlParameter("@Room_Num", Room_Num), new SqlParameter("@Score", Score), new SqlParameter("@ObjId", ObjId) }, CommandType.Text);

            if (RoomCount != 0)
            {
                int PassCount = (int)Mydb.ExecuteScalar("select COUNT(*) from PER_SCORE where  PASS=@PassT and SCORE_ID=@Score and OBJECT_ID=@ObjId and ROOM_ID=(select ROOM_ID from ROOM where ROOM_NUMBER=@Room_Num and OBJECT_ID=@obj_Id)", new SqlParameter[] { new SqlParameter("@PassT", PassT), new SqlParameter("@Score", Score), new SqlParameter("@ObjId", ObjId), new SqlParameter("@Room_Num", Room_Num), new SqlParameter("@obj_Id", ObjId) }, CommandType.Text);

                if (PassCount == 1)
                {
                    int ProjectId = (int)Mydb.ExecuteScalar("select PROJECT_ID from OBJECT where OBJECT_ID=@ObjId", new SqlParameter[] { new SqlParameter("@ObjId", ObjId) }, CommandType.Text);

                    result = "{\"result\" : \"1\",\"objId\":\"" + ObjId + "\",\"C_Score\":\"" + Score + "\",\"ProjectId\":\"" + ProjectId + "\"}";  //"{\"result\" : \"1\",\"Id\" :\"" + Client_Id + "\",\"LogId\" :\"" + Id + "\",\"RoleId\":\"" + role + "\"}";
                    //  result = @"{result:1,objId:" + ObjId + ",C_Score:" + Score + ",ProjectDatas:" + ProjectDatas + "}";
                }
                else
                {
                    int ProjectId = (int)Mydb.ExecuteScalar("select PROJECT_ID from OBJECT where OBJECT_ID=@ObjId", new SqlParameter[] { new SqlParameter("@ObjId", ObjId) }, CommandType.Text);

                    string LoginBitrix = Mydb.ExecuteReadertoDataTableAsJson("usp_CHECK_BITRIX_USER", new SqlParameter[] { new SqlParameter("@login", Score), new SqlParameter("@pwd", PassT) }, CommandType.StoredProcedure);
                    // dynamic jsonSets = JsonConvert.DeserializeObject(sets);
                    dynamic jsonLoginBitrix = JsonConvert.DeserializeObject(LoginBitrix);
                    if (jsonLoginBitrix[0].LOTUS_GUID != "Login failed")
                    {
                        result = "{\"result\" : \"1\",\"objId\":\"" + ObjId + "\",\"C_Score\":\"" + Score + "\",\"ProjectId\":\"" + ProjectId + "\"}";
                    }
                    else
                    {
                        result = "{\"result\" : \"0\"}";
                    }
                }
            }
            else
            {
                result = "{\"result\" : \"0\"}";
            }
            return(result);
        }
Example #2
0
 public static string getDocs(string guid)
 {
     return(Mydb.ExecuteReadertoDataTableAsJson("Get_Supplier_DOCS", new SqlParameter[] { new SqlParameter("@guid", guid) }, CommandType.StoredProcedure));
 }