public void RegisterListener(string uniqueId, string jsonItems)
        {
            Guid tenantId = get_tenant_id();

            if (!ConnectedUsers.ContainsKey(Context.ConnectionId) ||
                string.IsNullOrEmpty(jsonItems) || !Modules.RaaiVanConfig.Modules.RealTime(tenantId))
            {
                return;
            }

            Dictionary <string, object> items = PublicMethods.fromJSON(jsonItems);

            List <string> allNames = new List <string>();

            foreach (string n in items.Keys)
            {
                if (string.IsNullOrEmpty(n))
                {
                    continue;
                }

                string feedId = !((Dictionary <string, object>)items[n]).ContainsKey("FeedID") ? string.Empty :
                                ((Dictionary <string, object>)items[n])["FeedID"].ToString().ToLower();

                allNames.Add(n);

                if (string.IsNullOrEmpty(feedId))
                {
                    if (!ConnectedUsers[Context.ConnectionId].Events.Any(u => u == n))
                    {
                        ConnectedUsers[Context.ConnectionId].Events.Add(n);
                    }
                }
                else
                {
                    if (!Feeds.ContainsKey(feedId))
                    {
                        Feeds[feedId] = new Dictionary <string, SortedSet <string> >();
                    }
                    if (!Feeds[feedId].ContainsKey(n))
                    {
                        Feeds[feedId][n] = new SortedSet <string>();
                    }
                    if (!Feeds[feedId][n].Any(u => u == Context.ConnectionId))
                    {
                        Feeds[feedId][n].Add(Context.ConnectionId);
                    }
                }
            }

            Clients.Client(Context.ConnectionId).Registered(uniqueId, string.Join(",", allNames));
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            paramsContainer = new ParamsContainer(HttpContext.Current, nullTenantResponse: true);
            if (!paramsContainer.ApplicationID.HasValue)
            {
                return;
            }

            string responseText = string.Empty;

            switch (PublicMethods.parse_string(context.Request.Params["Type"], false, "Node").ToLower())
            {
            case "node":
                nodes_rss(PublicMethods.parse_guid(context.Request.Params["NodeTypeID"]),
                          HttpUtility.UrlDecode(PublicMethods.parse_string(context.Request.Params["Title"], false, string.Empty)),
                          HttpUtility.UrlDecode(PublicMethods.parse_string(context.Request.Params["Description"], false, string.Empty)),
                          PublicMethods.parse_int(context.Request.Params["Count"], 20),
                          PublicMethods.parse_long(context.Request.Params["LowerBoundary"]),
                          HttpUtility.UrlDecode(PublicMethods.parse_string(context.Request.Params["SearchText"], false, string.Empty)),
                          PublicMethods.parse_bool(context.Request.Params["IsDocument"]),
                          PublicMethods.parse_bool(context.Request.Params["IsKnowledge"]),
                          PublicMethods.parse_bool(context.Request.Params["Sitemap"]));
                return;

            case "question":
                questions_rss(HttpUtility.UrlDecode(PublicMethods.parse_string(context.Request.Params["Title"], false, string.Empty)),
                              HttpUtility.UrlDecode(PublicMethods.parse_string(context.Request.Params["Description"], false, string.Empty)),
                              PublicMethods.parse_int(context.Request.Params["Count"], 20));
                return;

            case "external":
                List <string> urlsArr = ListMaker.get_string_items(context.Request.Params["URLs"], '|').ToList();
                List <KeyValuePair <string, string> > urls = new List <KeyValuePair <string, string> >();
                foreach (string str in urlsArr)
                {
                    int index = str.IndexOf(',');
                    urls.Add(new KeyValuePair <string, string>(str.Substring(index + 1), Base64.decode(str.Substring(0, index)).ToLower()));
                }

                external(urls,
                         PublicMethods.parse_int(context.Request.Params["Count"], 20),
                         PublicMethods.parse_guid(context.Request.Params["StoreAsNodeTypeID"]), ref responseText);
                paramsContainer.return_response(ref responseText);
                return;

            case "sitemapindex":
                get_sitemap_index(PublicMethods.parse_int(context.Request.Params["Count"]));
                return;
            }

            paramsContainer.return_response(PublicConsts.BadRequestResponse);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (DBNulls.StringValue(Session[PublicMethods.ConstUserEmail]).Equals(""))
        {
            Response.Redirect("Login.aspx");
        }
        if (!IsPostBack)
        {
            Session["Type_Id"] = null;
        }

        PublicMethods.LocalizeRadGridFilters(rgIssueMaster);
    }
Exemple #4
0
        private void SwapItem(int index1, int index2)
        {
            bool checked1 = checkedListBox1.GetItemChecked(index1);
            bool checked2 = checkedListBox1.GetItemChecked(index2);

            object obj1Copy = PublicMethods.DeepClone(checkedListBox1.Items[index1]);

            checkedListBox1.Items[index1] = checkedListBox1.Items[index2];
            checkedListBox1.Items[index2] = obj1Copy;

            checkedListBox1.SetItemChecked(index1, checked2);
            checkedListBox1.SetItemChecked(index2, checked1);
        }
Exemple #5
0
        private string GetID(AssetsData dr, GroupInfo item)
        {
            string fieldName  = item.GetFieldName();
            object objValue   = PublicMethods.GetPropertyValue(dr, fieldName);
            string fieldValue = objValue == null ? "" : objValue.ToString();

            if (string.IsNullOrEmpty(fieldValue))
            {
                fieldValue = GlobalInfo.Undefined;
            }

            return(fieldValue);
        }
 public string toJson()
 {
     return("{\"InstanceID\":\"" + (!InstanceID.HasValue ? string.Empty : InstanceID.Value.ToString()) + "\"" +
            ",\"FormID\":\"" + (!FormID.HasValue ? string.Empty : FormID.Value.ToString()) + "\"" +
            (!TemplateFormID.HasValue ? string.Empty : ",\"TemplateFormID\":\"" + TemplateFormID.Value.ToString() + "\"") +
            ",\"OwnerID\":\"" + (OwnerID.HasValue ? OwnerID.Value.ToString() : string.Empty) + "\"" +
            ",\"DirectorID\":\"" + (DirectorID.HasValue ? DirectorID.Value.ToString() : string.Empty) + "\"" +
            ",\"IsTemporary\":" + (IsTemporary.HasValue && IsTemporary.Value).ToString().ToLower() +
            ",\"CreationDate\":\"" + (CreationDate.HasValue ? CreationDate.Value.ToString() : string.Empty) + "\"" +
            ",\"CreationDate_Jalali\":\"" + (!CreationDate.HasValue ? string.Empty :
                                             PublicMethods.get_local_date(CreationDate.Value)) + "\"" +
            "}");
 }
Exemple #7
0
        public static Dictionary <Guid, List <PermissionType> > check_access(Guid applicationId,
                                                                             Guid?userId, List <Guid> objectIds, PrivacyObjectType objectType, List <PermissionType> permissions)
        {
            Dictionary <Guid, List <PermissionType> > ret = new Dictionary <Guid, List <PermissionType> >();

            PublicMethods.split_list <Guid>(objectIds, 200, ids =>
            {
                DataProvider.CheckAccess(applicationId, userId, ids, objectType, permissions)
                .ToList().ForEach(x => ret.Add(x.Key, x.Value));
            });

            return(ret);
        }
        private string map_path(Guid?applicationId, ref bool isPublic, string dest = null)
        {
            if (!FolderName.HasValue)
            {
                return(string.Empty);
            }

            dest = string.IsNullOrEmpty(dest) ? string.Empty : (dest[0] == '\\' ? string.Empty : "\\") + dest;

            string folder = _get_folder_path(applicationId, FolderName.Value, ref isPublic, cephMode: CephMode) + dest.Replace("\\", "/");

            return(CephMode ? folder : PublicMethods.map_path("~/" + folder));
        }
Exemple #9
0
        protected void get_messages(Guid?threadId, long?minId, int?count, ref string responseText)
        {
            //Privacy Check: OK
            if (!paramsContainer.GBEdit)
            {
                return;
            }

            if (!count.HasValue)
            {
                count = 0;
            }

            List <Message> messages = !threadId.HasValue ? new List <Message>() :
                                      MSGController.get_messages(paramsContainer.Tenant.Id,
                                                                 paramsContainer.CurrentUserID.Value, threadId, null, minId, count);

            responseText = "{\"MinID\":" + (messages.Count > 0 ? messages.Min(u => u.ID) : 0).ToString() +
                           ",\"Messages\":[";

            List <DocFileInfo> attachments = DocumentsController.get_owner_files(paramsContainer.Tenant.Id,
                                                                                 messages.Where(u => u.HasAttachment.HasValue && u.HasAttachment.Value).Select(v => v.MessageID.Value).ToList());

            bool isFirst = true;

            foreach (Message msg in messages)
            {
                responseText += (isFirst ? string.Empty : ",") +
                                "{\"ID\":\"" + msg.ID.ToString() + "\"" +
                                ",\"ThreadID\":\"" + msg.ThreadID.Value.ToString() + "\"" +
                                ",\"MessageID\":\"" + msg.MessageID.Value.ToString() + "\"" +
                                ",\"IsGroup\":" + (msg.IsGroup.HasValue && msg.IsGroup.Value).ToString().ToLower() +
                                ",\"IsSender\":" + (msg.IsSender.HasValue && msg.IsSender.Value).ToString().ToLower() +
                                ",\"Seen\":" + (msg.Seen.HasValue && msg.Seen.Value).ToString().ToLower() +
                                ",\"Title\":\"" + Base64.encode(msg.Title) + "\"" +
                                ",\"MessageText\":\"" + Base64.encode(msg.MessageText) + "\"" +
                                ",\"SendDate\":\"" + PublicMethods.get_local_date(msg.SendDate.Value, true) + "\"" +
                                ",\"ForwardedFrom\":\"" + (msg.ForwardedFrom.HasValue ? msg.ForwardedFrom.Value.ToString() : "") + "\"" +
                                ",\"SenderUserID\":\"" + msg.SenderUserID.ToString() + "\"" +
                                ",\"SenderUserName\":\"" + Base64.encode(msg.SenderUserName) + "\"" +
                                ",\"SenderFirstName\":\"" + Base64.encode(msg.SenderFirstName) + "\"" +
                                ",\"SenderLastName\":\"" + Base64.encode(msg.SenderLastName) + "\"" +
                                ",\"ProfileImageURL\":\"" + DocumentUtilities.get_personal_image_address(paramsContainer.Tenant.Id,
                                                                                                         msg.SenderUserID.Value) + "\"" +
                                ",\"AttachedFiles\":" + DocumentUtilities.get_files_json(paramsContainer.Tenant.Id, attachments.Where(u => u.OwnerID == msg.MessageID).ToList(), true) +
                                "}";
                isFirst = false;
            }

            responseText += "]}";
        }
Exemple #10
0
        private static DateTime?extract_date_from_parts(int year, string dateFieldName, XmlNode parentNode,
                                                        XmlNamespaceManager nsmgr, Dictionary <string, object> map)
        {
            if (string.IsNullOrEmpty(dateFieldName))
            {
                return(null);
            }
            dateFieldName = dateFieldName.ToLower();

            string monthFieldName = dateFieldName + "_month";
            string dayFieldName   = dateFieldName + "_day";

            int?month = null;
            int?day   = null;

            foreach (string name in map.Keys)
            {
                string target = map[name].GetType() == typeof(string) ? (string)map[name] : (
                    map[name].GetType() != typeof(Dictionary <string, object>) ? null : (
                        !((Dictionary <string, object>)map[name]).ContainsKey("target") ? null :
                        ((Dictionary <string, object>)map[name])["target"].ToString()
                        )
                    );

                if (string.IsNullOrEmpty(target) ||
                    (target.ToLower() != monthFieldName && target.ToLower() != dayFieldName))
                {
                    continue;
                }

                XmlNodeList lst = get_child_nodes(parentNode, name, nsmgr);
                int         val = 0;

                if (lst == null || lst.Count == 0 || !int.TryParse(lst.Item(0).InnerText, out val))
                {
                    continue;
                }

                if (target.ToLower() == monthFieldName)
                {
                    month = val;
                }
                else
                {
                    day = val;
                }
            }

            return(!month.HasValue || !day.HasValue ? null :
                   PublicMethods.persian_to_gregorian_date(year, month.Value, day.Value, null, null, null));
        }
Exemple #11
0
 public static void ResetLabelTool(Image imgLabel, Border bLabelToggle, Canvas cLabelTool, Label lLabelToggle)
 {
     if (PublicMethods.GetElementActualAngle(imgLabel) != 0)
     {
         int num = 0;
         imgLabel.RenderTransformOrigin = new Point(0.5, 0.5);
         imgLabel.RenderTransform       = new RotateTransform(num);
         imgLabel.Margin     = new Thickness(0.0, 0.0, 0.0, 0.0);
         bLabelToggle.Margin = new Thickness(-12.0, 42.0, 0.0, 0.0);
     }
     cLabelTool.Width     = 180.0;
     lLabelToggle.Content = ">";
     lLabelToggle.ToolTip = GlobalVariable.listCurrentLanguage[88];
 }
Exemple #12
0
        public static void UpdateMagnifierMark(MultiScaleImage mSlide, Grid gMagnifierFlipBox)
        {
            MultiScaleImage multiScaleImage = gMagnifierFlipBox.FindName("mMagnifier") as MultiScaleImage;
            Grid            grid            = gMagnifierFlipBox.FindName("gMagnifierMarkBox") as Grid;

            if (mSlide.Source == multiScaleImage.Source)
            {
                Grid grid2 = PublicMethods.FindSlideBox(mSlide).FindName("gMarkBox") as Grid;
                for (int i = 0; i < grid2.Children.Count; i++)
                {
                    grid.Children[i].Visibility = grid2.Children[i].Visibility;
                }
            }
        }
        public static void send_emails(Guid applicationId, int batchSize)
        {
            List <EmailQueueItem> items      = GlobalController.get_email_queue_items(applicationId, batchSize);
            List <long>           succeedIds = new List <long>();

            foreach (EmailQueueItem itm in items)
            {
                if (PublicMethods.send_email(applicationId, itm.Email, itm.Title, itm.EmailBody))
                {
                    succeedIds.Add(itm.ID.Value);
                }
            }
            GlobalController.archive_email_queue_items(applicationId, succeedIds);
        }
        public override Task OnConnected()
        {
            Guid tenantId = Guid.Empty;

            try
            {
                tenantId = PublicMethods.get_current_tenant(Context.Request.GetHttpContext().GetOwinContext().Request,
                                                            RaaiVanSettings.Tenants).Id;
            }
            catch (Exception ex) { return(base.OnConnected()); }

            if (!RaaiVanSettings.RealTime(tenantId))
            {
                return(base.OnConnected());
            }

            Guid currentUserId = get_current_user_id();

            if (currentUserId == Guid.Empty)
            {
                return(base.OnConnected());
            }

            if (!UserConnectionsDic.ContainsKey(currentUserId))
            {
                UserConnectionsDic[currentUserId] = new List <string>();
            }

            bool added = false;

            if (!UserConnectionsDic[currentUserId].Any(u => u == Context.ConnectionId))
            {
                UserConnectionsDic[currentUserId].Add(Context.ConnectionId);
                added = true;
            }

            ConnectedUsers.Add(Context.ConnectionId,
                               new Registration(Context.ConnectionId, tenantId, currentUserId, new List <string>()));

            //if the user is now online, tell his/her friends
            if (UserConnectionsDic[currentUserId].Count == 1 && added)
            {
                prepare_user(tenantId, currentUserId);
                string userJson = _get_user_json(tenantId, currentUserId);

                RaaiVanHub.SendData(tenantId, get_friends(tenantId, currentUserId), RealTimeAction.IsOnline, userJson);
            }

            return(base.OnConnected());
        }
Exemple #15
0
        private void tsbExcelExport_Click(object sender, EventArgs e)
        {
            string excelFileName = entityData.Text;

            excelFileName = PublicMethods.SetFilePath("*..xlsx|*..xlsx", excelFileName);
            if (string.IsNullOrEmpty(excelFileName))
            {
                return;
            }
            if (MyMethod.GetUserSel("文件保存成功,是否打开?"))
            {
                MyMethod.RunApp(excelFileName);
            }
        }
        public void GetData(string name, string data)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            Guid tenantId = Guid.Empty;

            try
            {
                tenantId = PublicMethods.get_current_tenant(Context.Request.GetHttpContext().GetOwinContext().Request,
                                                            RaaiVanSettings.Tenants).Id;
            }
            catch { return; }

            Guid currentUserId = get_current_user_id();

            name = name.ToLower();
            Dictionary <string, string> dataDic = PublicMethods.json2dictionary(data);

            switch (name)
            {
            case "istyping":
                if (dataDic.ContainsKey("GroupID"))
                {
                    show_is_typing(tenantId, currentUserId, dataDic);
                }
                break;

            case "isnottyping":
                if (dataDic.ContainsKey("GroupID"))
                {
                    hide_is_typing(tenantId, currentUserId, dataDic);
                }
                break;

            case "newchat":
                new_chat(tenantId, currentUserId, dataDic);
                break;

            case "newchatmember":
                if (dataDic.ContainsKey("GroupID"))
                {
                    new_chat_member(tenantId, currentUserId, dataDic);
                }
                break;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            paramsContainer = new ParamsContainer(context, nullTenantResponse: true);
            if (!paramsContainer.ApplicationID.HasValue)
            {
                return;
            }

            string responseText = string.Empty;
            string command      = PublicMethods.parse_string(context.Request.Params["Command"], false);

            switch (command)
            {
            case "Search":
                List <SearchDocType> itemTypes = new List <SearchDocType>();

                SearchDocType tempDt = new SearchDocType();
                foreach (string str in ListMaker.get_string_items(context.Request.Params["ItemTypes"], '|'))
                {
                    if (Enum.TryParse <SearchDocType>(str, out tempDt))
                    {
                        itemTypes.Add(tempDt);
                    }
                }

                search(itemTypes,
                       PublicMethods.parse_string(context.Request.Params["SearchText"]),
                       PublicMethods.parse_int(context.Request.Params["LowerBoundary"]),
                       PublicMethods.parse_int(context.Request.Params["Count"]),
                       PublicMethods.parse_bool(context.Request.Params["Title"]),
                       PublicMethods.parse_bool(context.Request.Params["Description"]),
                       PublicMethods.parse_bool(context.Request.Params["Content"]),
                       PublicMethods.parse_bool(context.Request.Params["Tags"]),
                       PublicMethods.parse_bool(context.Request.Params["FileContent"]),
                       PublicMethods.parse_bool(context.Request.Params["ForceHasContent"]),
                       ListMaker.get_guid_items(context.Request.Params["TypeIDs"], '|'),
                       ListMaker.get_string_items(context.Request.Params["Types"], '|'),
                       PublicMethods.parse_bool(context.Request.Params["ShowExactItems"]),
                       PublicMethods.parse_bool(context.Request.Params["SuggestNodeTypes"]),
                       PublicMethods.parse_bool(context.Request.Params["Excel"]),
                       PublicMethods.parse_bool(context.Request.Params["FormDetails"]),
                       PublicMethods.fromJSON(PublicMethods.parse_string(context.Request.Params["ColumnNames"])),
                       ref responseText);
                _return_response(ref responseText);
                return;
            }

            paramsContainer.return_response(PublicConsts.BadRequestResponse);
        }
 public string toJson()
 {
     return("{\"ObjectID\":" + (!ObjectID.HasValue ? "null" : "\"" + ObjectID.Value.ToString() + "\"") +
            ",\"RoleID\":" + (!RoleID.HasValue ? "null" : "\"" + RoleID.Value.ToString() + "\"") +
            ",\"RoleName\":\"" + Base64.encode(RoleName) + "\"" +
            ",\"RoleType\":\"" + Base64.encode(RoleType) + "\"" +
            ",\"NodeType\":\"" + Base64.encode(NodeType) + "\"" +
            ",\"AdditionalID\":\"" + Base64.encode(AdditionalID) + "\"" +
            ",\"Allow\":" + (!Allow.HasValue ? "null" : Allow.Value.ToString().ToLower()) +
            ",\"ExpirationDate\":" + (!ExpirationDate.HasValue ? "null" : "\"" + ExpirationDate.Value.ToString("yyyy-MM-dd") + "\"") +
            ",\"ExpirationDate_Locale\":" + (!ExpirationDate.HasValue ? "null" :
                                             "\"" + PublicMethods.get_local_date(ExpirationDate.Value) + "\"") +
            ",\"PermissionType\":" + (PermissionType == PermissionType.None ? "null" : "\"" + PermissionType.ToString() + "\"") +
            "}");
 }
Exemple #19
0
        private string GetNewPjnd(DataTable dt)
        {
            List <string> lstPjnd      = PublicMethods.GetLstStringByDataTable(dt, "pjnd");
            string        pjndTemplate = DateTime.Now.ToString("yyyyMM");

            DataRow[] drAry = dt.Select("pjnd='" + pjndTemplate + "'");
            if (drAry.Length <= 0)
            {
                return(pjndTemplate);
            }

            string newPjnd = PublicMethods.CreateNewName(lstPjnd, pjndTemplate + "_");

            return(newPjnd);
        }
        private static string get_login_key()
        {
            string timeStamp = get_timestamp();

            NameValueCollection values = new NameValueCollection();

            values.Add("time", timeStamp);
            values.Add("hash", PublicMethods.sha256(SecretKey + timeStamp));
            values.Add("clientId", ClientID);

            Dictionary <string, object> jsonResponse = PublicMethods.fromJSON(
                PublicMethods.web_request(GetLoginKeyURL, values, HTTPMethod.PUT, get_headers(timeStamp)));

            return(jsonResponse == null || !jsonResponse.ContainsKey("loginKey") ? string.Empty : jsonResponse["loginKey"].ToString());
        }
Exemple #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            uctNewTreeByTree1.GetChangedLstAssetsData(out lstAssetsAdd, out lstAssetsDel);
            if (lstAssetsDel != null && lstAssetsDel.Count > 0)
            {
                List <string> lstDydm = PublicMethods.GetLstStringByLstT(lstAssetsDel, "ID");
                string        strDydm = PublicMethods.GetStringByLstString(lstDydm);
                if (PublicMethods.AskQuestion(this, "您确定要删除以下单元及该单元在其评价年度下的所有预测信息么?\r\n" + strDydm) == false)
                {
                    return;
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Exemple #22
0
        private static bool send_api(string phoneNumber, string message)
        {
            return(true);

            //Get Token
            NameValueCollection headers = new NameValueCollection();

            NameValueCollection data = new NameValueCollection();

            data.Add("UserApiKey", apiKey);
            data.Add("SecretKey", secretKey);

            Dictionary <string, object> response = PublicMethods.fromJSON(
                PublicMethods.web_request("https://RestfulSms.com/api/Token", data, HTTPMethod.POST, headers: headers));

            bool   succeed = PublicMethods.get_dic_value <bool>(response, "IsSuccessful", false);
            string token   = !succeed ? string.Empty : PublicMethods.get_dic_value(response, "TokenKey", string.Empty);

            //end of Get Token


            if (string.IsNullOrEmpty(token))
            {
                return(false);
            }


            //Send SMS
            headers = new NameValueCollection();
            headers.Add("x-sms-ir-secure-token", token);

            data = new NameValueCollection();
            data.Add("Messages", "new message");
            data.Add("MobileNumbers", "09192388661");
            data.Add("LineNumber", "50002015264136");
            data.Add("CanContinueInCaseOfError", "true");

            response = PublicMethods.fromJSON(
                PublicMethods.web_request("https://RestfulSms.com/api/MessageSend", data, HTTPMethod.POST, headers: headers));

            string xx = response.ToString();

            //end of Send SMS



            return(true);
        }
Exemple #23
0
        public static string extract_file_content(Guid applicationId, DocFileInfo file)
        {
            ISolrOperations <SolrDoc> solr = get_solr_operator();

            using (Stream content = new MemoryStream(file.toByteArray(applicationId)))
            {
                ExtractResponse response = solr.Extract(new ExtractParameters(content,
                                                                              PublicMethods.get_random_number().ToString(), PublicMethods.random_string(10))
                {
                    ExtractOnly   = true,
                    ExtractFormat = ExtractFormat.Text
                });

                return(response.Content);
            }
        }
Exemple #24
0
        public async Task <IHttpActionResult> PostUserMaster(UserMaster userMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            userMaster.UpdateDate = DateTime.Now;
            userMaster.InsertDate = DateTime.Now;
            userMaster.Password   = PublicMethods.MD5(userMaster.Password);
            userMaster.UseFlag    = true;
            db.UserMaster.Add(userMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = userMaster.UserID }, userMaster));
        }
        protected bool send_sms()
        {
            if (string.IsNullOrEmpty(_PhoneNumber))
            {
                return(false);
            }

            bool result = PublicMethods.send_sms(_PhoneNumber, sms_body());

            if (result)
            {
                _Media = "SMS";
            }

            return(result);
        }
 public string toJson(Guid applicationId)
 {
     return("{\"TemplateID\":\"" + (!TemplateID.HasValue ? string.Empty : TemplateID.ToString()) + "\"" +
            ",\"TemplateName\":\"" + Base64.encode(TemplateName) + "\"" +
            ",\"ActivatedID\":\"" + (!ActivatedID.HasValue ? string.Empty : ActivatedID.ToString()) + "\"" +
            ",\"ActivatedName\":\"" + Base64.encode(ActivatedName) + "\"" +
            ",\"ActivationDate\":\"" + (!ActivationDate.HasValue ? string.Empty : ActivationDate.Value.ToString("yyyy-MM-dd")) + "\"" +
            ",\"ActivationDate_Jalali\":\"" + PublicMethods.get_local_date(ActivationDate) + "\"" +
            ",\"Activator\":" + Activator.toJson(applicationId, profileImageUrl: true) +
            ",\"TemplateElementsCount\":" + (!TemplateElementsCount.HasValue ? 0 : TemplateElementsCount.Value).ToString() +
            ",\"ElementsCount\":" + (!ElementsCount.HasValue ? 0 : ElementsCount.Value).ToString() +
            ",\"NewTemplateElementsCount\":" + (!NewTemplateElementsCount.HasValue ? 0 : NewTemplateElementsCount.Value).ToString() +
            ",\"RemovedTemplateElementsCount\":" + (!RemovedTemplateElementsCount.HasValue ? 0 : RemovedTemplateElementsCount.Value).ToString() +
            ",\"NewCustomElementsCount\":" + (!NewCustomElementsCount.HasValue ? 0 : NewCustomElementsCount.Value).ToString() +
            "}");
 }
Exemple #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            string chartTemplateFile = "DYTemplate.xml";
            string seriesOptionsFile = "DYSeriesOptions.xml";

            chartTemplateFile = PublicMethods.GetAbsolutePath(chartTemplateFile);
            seriesOptionsFile = PublicMethods.GetAbsolutePath(seriesOptionsFile);

            DecParams decParams = new DecParams();

            decParams.ProID        = "ff2e59ed-76e7-489f-91ed-85e57cd6cc24";
            decParams.PreStartDate = new DateTime(2014, 11, 1);
            DataTable dt = new DYMonthDataService().GetDataTable("2201002", decParams.PreStartDate.ToString("yyyyMM"));

            uctChart1.LoadChart(chartTemplateFile, seriesOptionsFile, dt, decParams);
        }
        // GET: Accounts/Edit/5
        public async Task <IActionResult> Edit(uint?id)
        {
            ViewData["LoggedIn"] = PublicMethods.GetLoggedInUsername(HttpContext);
            if (id == null)
            {
                return(NotFound());
            }

            var accounts = await _context.Accounts.FindAsync(id);

            if (accounts == null)
            {
                return(NotFound());
            }
            return(View(accounts));
        }
Exemple #29
0
        void bgwLoad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                PublicMethods.WarnMessageBox(this, "加载窗体异常:" + e.Error.Message);
                return;
            }

            DataTable dt = e.Result as DataTable;

            if (dt == null)
            {
                return;
            }

            if (dt.TableName == "yymd")
            {
                List <string> lstDydm = PublicMethods.GetLstStringByDataTable(dt, "dydm");
                string        strDydm = PublicMethods.GetStringByLstString(lstDydm);
                if (string.IsNullOrEmpty(strDydm) == false)
                {
                    PublicMethods.WarnMessageBox(this, "以下单元因为缺少原油密度,无法转换成英式单元:\r\n" + strDydm);
                    return;
                }
            }

            this.unitType = this.unitType == UnitType.CnUnit ? UnitType.EnUnit : UnitType.CnUnit;
            this.treeHeadDataGridView1.DataSource = null;
            if (unitType == UnitType.EnUnit)
            {
                this.tsmUnitSwitch.Text = "切换为英式单位";
                this.tsbUnitSwich.Text  = "切换为英式单位";
                this.InitTreeHeadDataGridViewCN();
            }
            else
            {
                this.tsmUnitSwitch.Text = "切换为中式单位";
                this.tsbUnitSwich.Text  = "切换为中式单位";
                this.InitTreeHeadDataGridViewEN();
            }

            treeHeadDataGridView1.CellValueChanged -= treeHeadDataGridView1_CellValueChanged;
            treeHeadDataGridView1.DataSource        = dt;

            //dt.Columns[1].DataType;
            treeHeadDataGridView1.CellValueChanged += treeHeadDataGridView1_CellValueChanged;
        }
Exemple #30
0
        public static void MagnifierZoomAboutPoint(Grid gMagnifierFlipBox, MultiScaleImage mSlide, Border bMagnifierBorder, Point pSlideBoxPixelPoint, float fScreenRatio)
        {
            MultiScaleImage multiScaleImage = gMagnifierFlipBox.FindName("mMagnifier") as MultiScaleImage;

            gMagnifierFlipBox.FindName("gMagnifierMarkBox");
            if (mSlide.Source == null)
            {
                multiScaleImage.Visibility = Visibility.Collapsed;
                return;
            }
            multiScaleImage.Visibility = Visibility.Visible;
            if (multiScaleImage.Source != mSlide.Source)
            {
                multiScaleImage.Source = mSlide.Source;
                GetMagnifierMark(mSlide, gMagnifierFlipBox, fScreenRatio);
            }
            float num = mSlide.fTargetScale * 2f;

            if (multiScaleImage.OriginalScale != (double)num)
            {
                float num2 = float.Parse(multiScaleImage.DataContext.ToString()) * num;
                multiScaleImage.minScaleRelativeToMinSize = 1.0;
                multiScaleImage.OriginalScale             = num;
                multiScaleImage.MaxScaleRelativeToMaxSize = 4f * num;
                float currentScale = multiScaleImage.GetCurrentScale();
                multiScaleImage.ScaleCanvas(num2 / currentScale, new Point(bMagnifierBorder.Width / 2.0, bMagnifierBorder.Height / 2.0));
            }
            Point slideBoxFlipValue = PublicMethods.GetSlideBoxFlipValue(PublicMethods.FindSlideBox(mSlide));

            if (PublicMethods.GetElementFlipValue(gMagnifierFlipBox) != slideBoxFlipValue)
            {
                FlipTool.FlipElement(gMagnifierFlipBox, slideBoxFlipValue.X, slideBoxFlipValue.Y);
            }
            int elementActualAngle = PublicMethods.GetElementActualAngle(mSlide);

            if (PublicMethods.GetElementActualAngle(multiScaleImage) != elementActualAngle)
            {
                RotateMagnifier(multiScaleImage, elementActualAngle);
            }
            pSlideBoxPixelPoint = PublicMethods.FlipPoint(PublicMethods.FindSlideBox(mSlide), pSlideBoxPixelPoint);
            Point pPixelPoint     = mSlide.BoxPixelToControlPixel(pSlideBoxPixelPoint);
            Point pNavigatorRatio = mSlide.ControlPixelToSlideRatio(pPixelPoint, false);
            Point pDeltaOffset    = multiScaleImage.RatioOffsetToDeltaOffset(pNavigatorRatio);

            multiScaleImage.DeltaToPan(pDeltaOffset);
            Mark.UpdateAllMarks(gMagnifierFlipBox, fScreenRatio);
        }