当前位置: 首页>>代码示例>>C#>>正文


C# Entities.AddToHMsGMapping方法代码示例

本文整理汇总了C#中Entities.AddToHMsGMapping方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.AddToHMsGMapping方法的具体用法?C# Entities.AddToHMsGMapping怎么用?C# Entities.AddToHMsGMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entities的用法示例。


在下文中一共展示了Entities.AddToHMsGMapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addNewUser


//.........这里部分代码省略.........
                                apiParam = String.Format("em={0}&fn={1}&ln={2}&tp={3}", csmail, nn, "Cablesoft",tp);
                                er.AppendLine(String.Format("apiParam={0}", apiParam));
                                using (WebClient zoomws = new WebClient() { Encoding = System.Text.Encoding.UTF8 })
                                {
                                    apiRes = zoomws.DownloadString(new Uri(Global.strWS + Global.createCustUser + apiParam));
                                }
                                apiRes = Global.getAPIJson(apiRes);
                                er.AppendLine(String.Format("apiRes={0}", apiRes));
                                //newUser nu = JsonConvert.DeserializeObject<newUser>(apiRes);
                                newUser nu = Global.jss.Deserialize<newUser>(apiRes);
                                eu.ZOOMID = nu.id;
                                er.AppendLine(String.Format("ZOOM ID={0}", nu.id));
                            }
                            else if (tp == 2)
                            {   //--- 可開會會員,一般都是用這個
                                er.AppendLine("type=1");
                                var ect = from e in db.EndUsers
                                          select new { e.EneUserID };
                                //--- 先呼叫API新增ZOOM CUST USER 然後取得其ZOOMID後再新增EndUser資料庫
                                string css = String.Format("CS{0:yyyyMMdd}", DateTime.Now);
                                string mm = String.Format("{0:00000}@cablesoft.com.tw", ect.Count());
                                string csmail = css + mm;

                                apiParam = String.Format("em={0}&fn={1}&ln={2}&tp={3}", csmail, nn, "Cablesoft", tp);
                                er.AppendLine(String.Format("apiParam={0}", apiParam));
                                using (WebClient zoomws = new WebClient() { Encoding = System.Text.Encoding.UTF8 })
                                {
                                    apiRes = zoomws.DownloadString(new Uri(Global.strWS + Global.createCustUser + apiParam));
                                }
                                apiRes = Global.getAPIJson(apiRes);
                                er.AppendLine(String.Format("apiRes={0}", apiRes));
                                //newUser nu = JsonConvert.DeserializeObject<newUser>(apiRes);
                                newUser nu = Global.jss.Deserialize<newUser>(apiRes);
                                eu.ZOOMID = nu.id;
                                er.AppendLine(String.Format("ZOOM ID={0}", nu.id));
                            }
                            else
                            {
                                er.AppendLine("type=3");
                                var ect = from e in db.EndUsers
                                          select new { e.EneUserID };
                                //--- 先呼叫API新增ZOOM CUST USER 然後取得其ZOOMID後再新增EndUser資料庫
                                string css = String.Format("CS{0:yyyyMMdd}", DateTime.Now);
                                string mm = String.Format("{0:00000}@cablesoft.com.tw", ect.Count());
                                string csmail = css + mm;

                                apiParam = String.Format("em={0}&fn={1}&ln={2}&tp={3}", csmail, nn, "Cablesoft", tp);
                                er.AppendLine(String.Format("apiParam={0}", apiParam));
                                using (WebClient zoomws = new WebClient() { Encoding = System.Text.Encoding.UTF8 })
                                {
                                    apiRes = zoomws.DownloadString(new Uri(Global.strWS + Global.createCustUser + apiParam));
                                }
                                apiRes = Global.getAPIJson(apiRes);
                                er.AppendLine(String.Format("apiRes={0}", apiRes));
                                //newUser nu = JsonConvert.DeserializeObject<newUser>(apiRes);
                                newUser nu = Global.jss.Deserialize<newUser>(apiRes);
                                eu.ZOOMID = nu.id;
                                er.AppendLine(String.Format("ZOOM ID={0}", nu.id));
                            }
                            db.EndUsers.AddObject(eu);

                            if (gid != null && gid.Length > 10)
                            {
                                er.AppendLine("準備建立清單");
                                HMsGMapping hm = new HMsGMapping()
                                {
                                    HMsGMappingID = Guid.NewGuid().ToString(),
                                    HMsGID = gid,
                                    MEID = eu.EneUserID,
                                    CreateDate = DateTime.Now
                                };
                                db.AddToHMsGMapping(hm);
                                er.AppendLine("對應清單建立成功");
                            }
                            db.SaveChanges();
                            tran.Commit();
                            er.AppendLine("SaveChanges\r\nEID=" + eu.EneUserID);
                            string title = "系統測試--0630 NBD System Testing";
                            string smail;
                            smail = "您好:您的帳號為:"+id+" 密碼為:"+pw+" 請確認帳號與密碼是否與您申請時無異 感謝您的註冊 NBD小組敬上同意";
                            cs.sendSMTP(mail,title,smail,ref er);
                            //var kk = new { eu.EneUserID, eu.euAccount, eu.euNickname, eu.IdentityTypeID, eu.ZOOMID, };
                            Global.funcLog(funcName, ps, er.ToString(), "Success:");
                            return Global.jss.Serialize(eu.EneUserID);
                        }
                        catch (Exception tex)
                        {
                            tran.Rollback();
                            er.AppendLine("交易失敗!" + tex.Message);
                            throw;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.funcLog(funcName, ps, er.AppendLine(ex.Message).ToString(), "Error");
                return Global.jss.Serialize(String.Format("Error code : 0x84177282005\r\n\r\n{0}", ex.Message));
            }
            }
开发者ID:jonathan00136,项目名称:testAPI,代码行数:101,代码来源:API_REST.cs


注:本文中的Entities.AddToHMsGMapping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。