Пример #1
0
        public AltaEmpresa(string rol)
        {
            InitializeComponent();
            ConfigGlobal cg           = new ConfigGlobal();
            DateTime     fechaSistema = cg.getFechaSistema();

            lblFechaSistema.Visible = true;
            lblFechaSistema.Text    = fechaSistema.ToString();
            rolLogueado             = rol;
            if (rolLogueado != "sin Rol")
            {
                textUsername.ReadOnly  = true;
                textUsername.Visible   = false;
                textUsername.BackColor = System.Drawing.SystemColors.Window;
                textPassword.ReadOnly  = true;
                textPassword.Visible   = false;
                textPassword.BackColor = System.Drawing.SystemColors.Window;
                labelUser.Text         = "Usuario y Password creadas por defecto.";
            }
            else
            {
                lblUsername.Visible = false;
                lblPassword.Visible = false;
            }
        }
Пример #2
0
        public AltaCliente(string rol)
        {
            InitializeComponent();
            foreach (string tipo in Documento.string_docu)
            {
                comboTipoDoc.Items.Add(tipo);
            }
            ConfigGlobal cg           = new ConfigGlobal();
            DateTime     fechaSistema = cg.getFechaSistema();

            lblFechaSistema.Visible = true;
            lblFechaSistema.Text    = fechaSistema.ToString();
            rolLogueado             = rol;
            if (rolLogueado != "sin Rol")
            {
                textUsername.ReadOnly  = true;
                textUsername.Visible   = false;
                textUsername.BackColor = System.Drawing.SystemColors.Window;
                textPassword.ReadOnly  = true;
                textPassword.Visible   = false;
                textPassword.BackColor = System.Drawing.SystemColors.Window;
                labelUser.Text         = "Usuario y Password creadas por defecto.";
            }
            else
            {
                lblUsername.Visible = false;
                lblPassword.Visible = false;
            }
        }
Пример #3
0
        private void btnSubirTxt_Click(object sender, EventArgs e)
        {
            try
            {
                //creamos un objeto OpenDialog que es un cuadro de dialogo para buscar archivos
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Filter = "Archivos de Texto (*.txt)|*.txt";                 //le indicamos el tipo de filtro en este caso que busque
                //solo los archivos excel

                dialog.Title    = "Seleccione el archivo de Text"; //le damos un titulo a la ventana
                dialog.FileName = string.Empty;                    //inicializamos con vacio el nombre del archivo
                //si al seleccionar el archivo damos Ok
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    List <string> FechaIncorrectas = new List <string>();
                    using (StreamReader sr = new StreamReader(dialog.FileName, false))
                    {
                        //string[] separarFecha = horaIngresada.ToString("HH:mm:ss").Split(':');//DateTime.Now.ToString("HH:mm:ss").Split(':');
                        //string hor = separarFecha[0];
                        //string minutos = separarFecha[1];
                        //int horas = int.Parse(hor);
                        //int horas =0;
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            //MessageBox.Show(line);
                            DateTime fechaTxt = Convert.ToDateTime(line);
                            //Valido las fechas
                            ConfigGlobal conf = new ConfigGlobal();
                            if (fechaTxt >= conf.getFechaSistema())
                            {
                                if (this.esFechaValida(fechaTxt))
                                {
                                    fechasValidas.Add(fechaTxt);
                                }
                            }
                            else
                            {
                                FechaIncorrectas.Add(line);
                            }
                        }
                    }


                    filtrarFechasValidas(fechasValidas);
                    for (int i = 0; i < FechaIncorrectas.Count; i++)
                    {
                        MessageBox.Show("Fecha incorrecta " + FechaIncorrectas[i]);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SqliteCreacion.SituarBd_EnDirectorioLocal();
            ConfigGlobal.InicializarConexion(ConfigGlobal.TipoConexion.Sqlite);

            Application.Run(new InicioForm());
        }
Пример #5
0
        /// <summary>
        /// method to save setting
        /// </summary>
        private void SaveSetting()
        {
            ConfigGlobal.SettingConfig.Database_Catalog           = txtCatalog.Text;
            ConfigGlobal.SettingConfig.DataBase_SqlServer         = txtSqlServer.Text;
            ConfigGlobal.SettingConfig.Database_SqlAuthentication = rbtnSqlServerAuthentication.Checked;
            ConfigGlobal.SettingConfig.Database_Password          = txtPassword.Text;
            ConfigGlobal.SettingConfig.Database_UserName          = txtLogin.Text;

            ConfigGlobal.Save();
        }
Пример #6
0
        private void btnFiltroFecha_Click(object sender, EventArgs e)
        {
            grafico.Visible       = true;
            dataGridView1.Visible = true;
            string tipoEstadistica = cbxTipoEstadistica.SelectedItem.ToString();
            string anio            = cbxAnio.SelectedItem.ToString();
            string trimestre       = cbxTrimestre.SelectedItem.ToString();

            Estadistica  estadistica     = new Estadistica();
            ConfigGlobal conf            = new ConfigGlobal();
            DateTime     fechaDelSistema = conf.getFechaSistema();
            DataTable    dt = new DataTable();

            switch (tipoEstadistica)
            {
            case "Empresas con mayor cantidad de localidades no vendidas":
                //	//estadistica.getLocalidadesNoVendidas(dataGridView1,trimestre, anio);
                break;

            case "Clientes con mayores puntos vencidos":
                dt = estadistica.getClientesMasPuntosVencidos(dataGridView1, trimestre, anio);
                CargarData.cargarGridView(dataGridView1, dt);
                grafico.Series[0].ChartType = SeriesChartType.Line;
                grafico.Series[0].Name      = "Puntos Vencidos por Compras";
                foreach (DataRow drow in dt.Rows)
                {
                    grafico.Series[0].Points.AddXY(drow["Cantidad de compras"].ToString(), drow["Puntos Vencidos"].ToString());
                }

                break;

            case "Clientes con mayor cantidad de compras":
                dt = estadistica.getClientesMayorCompras(dataGridView1, trimestre, anio);
                CargarData.cargarGridView(dataGridView1, dt);
                grafico.Series[0].ChartType = SeriesChartType.Line;
                grafico.Series[0].Name      = "Compras por Publicaciones";
                foreach (DataRow drow in dt.Rows)
                {
                    grafico.Series[0].Points.AddXY(drow["Cantidad de compras"].ToString(), drow["Cantidad de Publicaciones"].ToString());
                }
                break;

            default:
                MessageBox.Show("Ha ocurrido un error al cargar los datos.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;
            }


            //Empresas con mayor cantidad de localidades no vendidas, dicho listado debe
            //filtrarse por grado de visibilidad de la publicación y por mes - año.Primero se
            // deberá ordenar por fecha y luego por visibilidad.

            //● Clientes con mayor cantidad de compras, agrupando las publicaciones por
            //empresa.
        }
Пример #7
0
        // GET: Home/Refresh
        public ActionResult Refresh()
        {
            Service.Model.Config.UpdateAssemblyInfo(Assembly.GetExecutingAssembly());

            ConfigGlobal.Refresh();
            Service.Scheduler.Schedule.Cache.RefreshCache();

            CameraSource.Cache.RefreshCache();

            return(RedirectToAction("Index", "Home"));
        }
Пример #8
0
        private void CanjePuntos_Load(object sender, EventArgs e)
        {
            ConfigGlobal global         = new ConfigGlobal();
            int          puntosVigentes = 0;

            fechaDelSistema = global.getFechaSistema();
            DaoSP dao = new DaoSP();

            lblPuntosACanjear.Visible = false;
            //Busco los puntos de ese cliente
            puntosVigentes         = puntos.consultarPuntosVigentes(fechaDelSistema, userLogueado.cliente.numeroDocumento);
            lblPuntosVigentes.Text = puntosVigentes.ToString();

            //Busco los premios que pueda a llegar a canjear un cliente,
            //tener en cuenta que los premios tienen su puntaje,
            //por ende el cliente segun sus puntos es el premio que le corresponde.
            DataTable dtPremios = new DataTable();
            string    query     = "select distinct p.Id as IdPremio,p.descripcion as Descripcion,PuntosVigentes,p.puntos as Puntos,FechaVencimiento from dropeadores.Puntos pu, " +
                                  " dropeadores.Premio p where Id_Cliente =" + userLogueado.cliente.numeroDocumento +
                                  " and pu.PuntosVigentes > p.puntos and FechaVencimiento > '" + fechaDelSistema + "' ";

            dtPremios = dao.ConsultarConQuery(query);
            DataTable dtPremios2 = new DataTable();
            string    query2     = "select distinct p.puntos as Puntos,p.descripcion  from dropeadores.Puntos pu, " +
                                   " dropeadores.Premio p where Id_Cliente =" + userLogueado.cliente.numeroDocumento +
                                   " and pu.PuntosVigentes > p.puntos and FechaVencimiento > '" + fechaDelSistema + "' ";

            dtPremios2 = dao.ConsultarConQuery(query2);
            if (dtPremios.Rows.Count <= 0)
            {
                MessageBox.Show("No existen puntos asociados al cliente, o no existen premios para la cantidad de puntos asociados.", "Error al cargar los puntos",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataRow rowPremios = dtPremios.Rows[0];
                premio.Id          = int.Parse(rowPremios["IdPremio"].ToString());
                premio.puntos      = int.Parse(rowPremios["Puntos"].ToString());
                premio.descripcion = rowPremios["Descripcion"].ToString();
                CargarData.cargarComboBox(cbxPremios, dtPremios2, "Puntos", "descripcion");
            }


            DataTable dtcli = new DataTable();

            dtcli = dao.ConsultarConQuery("select nombre,apellido,NumeroDocumento from dropeadores.Cliente where NumeroDocumento= " + userLogueado.cliente.numeroDocumento);
            DataRow rowcli = dtcli.Rows[0];

            cliente.nombre          = rowcli["nombre"].ToString();
            cliente.apellido        = rowcli["apellido"].ToString();
            cliente.numeroDocumento = int.Parse(rowcli["NumeroDocumento"].ToString());
            lblCliente.Text         = cliente.nombre + " " + cliente.apellido;
            lblDniCli.Text          = cliente.numeroDocumento.ToString();
        }
Пример #9
0
        private void cargarTabla()
        {
            ConfigGlobal fech = new ConfigGlobal();

            DaoSP prueba = new DaoSP();

            dataGridViewCompra.DataSource         = ubicacionesSeleccionadas;
            dataGridViewCompra.Columns[2].Visible = false;
            dataGridViewCompra.Columns[6].Visible = false;
            dataGridViewCompra.Columns[4].Visible = false;
        }
 private void SaveSetting()
 {
     ConfigGlobal.SettingConfig.Setting_ProjectName      = txtProjectName.Text;
     ConfigGlobal.SettingConfig.Setting_ClassPrefix      = txtClassPrefix.Text;
     ConfigGlobal.SettingConfig.Setting_SpPrefix         = txtSpPrefix.Text;
     ConfigGlobal.SettingConfig.Setting_OutputDirectory  = txtOutputDir.Text;
     ConfigGlobal.SettingConfig.Setting_FoudationLink    = txtFoudationLink.Text;
     ConfigGlobal.SettingConfig.Setting_MemoryWorkerBase = txtMemoryWorkerBase.Text;
     ConfigGlobal.SettingConfig.Setting_CheckGenByForder = chkGeneratorByFolder.Checked;
     ConfigGlobal.Save();
 }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="transaction"></param>
        /// <returns></returns>
        private async Task <TransactionResult> BarCodeTransactionAsync(Transaction transaction, Domain.Enums.TransactionType action)
        {
            switch (ConfigGlobal.GetValue("Payment", "BarCodeProvider").ToLower())
            {
            case "cielo":
                return(await CieloProviderAsync(transaction, action));

            default:
                throw new Exception("Provider not set");
            }
        }
Пример #12
0
        protected SecurityTokenResult GetSubscribersToken(ApplicationDetails appAuth)
        {
            try
            {
                SecurityKey  = new SymmetricSecurityKey(Encoding.Default.GetBytes(ConfigGlobal.GetValue("Application", "AppSecretKey")));
                TokenHandler = new JwtSecurityTokenHandler();

                if (appAuth != null &&
                    appAuth.AppId > 0)
                {
                    ///Criamos uma identidade
                    ClaimsIdentity claimsIdentity = new ClaimsIdentity();

                    ///Claim de acesso
                    Collection <Claim> claims = new Collection <Claim>
                    {
                        new Claim(ClaimTypes.PrimarySid, appAuth.AppId.ToString()),
                        new Claim(ClaimTypes.SerialNumber, appAuth.AppUid.ToString()),
                        new Claim(ClaimTypes.UserData, appAuth.AppDescription.ToString()),
                        new Claim(ClaimTypes.Role, ((int)appAuth.Owner).ToString()),
                        new Claim("AccountStatus", ((int)appAuth.AccountStatus).ToString()),
                    };

                    ///Configura os Token
                    var tokenDescriptor = new SecurityTokenDescriptor
                    {
                        Issuer             = ConfigGlobal.GetValue("Application", "Issuer"),
                        Subject            = claimsIdentity,
                        SigningCredentials = new SigningCredentials(SecurityKey, SecurityAlgorithms.HmacSha256, SecurityAlgorithms.Sha256Digest)
                    };

                    ///Gera o Token e retorna a string
                    SecurityToken token       = TokenHandler.CreateToken(tokenDescriptor);
                    var           tokenString = TokenHandler.WriteToken(token);

                    ///Retorna
                    return(new SecurityTokenResult
                    {
                        Create = DateTime.UtcNow,
                        Token = tokenString,
                        Expires = DateTime.UtcNow.AddHours(1),
                    });
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Пример #13
0
        private void btnConnectOracle_Click(object sender, EventArgs e)
        {
            LoadListFile();
            LoadListFieldsBool();

            ConfigGlobal.SettingConfig.Setting_EntityPath = txtLinkMapEntity.Text.Trim();
            ConfigGlobal.Save();

            var loginScreen = new ConnectStringForm();
            var result      = loginScreen.ShowDialog();

            this.DialogResult = result;
            this.Close();
        }
Пример #14
0
        public void Execute(object state)
        {
            try
            {
                ConfigGlobal.Refresh();
                Schedule.Cache.RefreshCache();

                CameraSource.Cache.RefreshCache();

                ExamineSchedulerException();

                _log.Info("Scheduler executed: (RefreshCache)");
            }
            catch (Exception ex)
            {
                _log.Warn("Scheduler failed: (RefreshCache)");
                _log.Error(ex);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                OracleHelper.ConnectionString = txtConnectionString.Text.Trim();
                OracleHelper.IsConectOracle   = true;
                OracleHelper.GetDt("select 5 from dual");

                DialogResult = DialogResult.OK;
                Close();


                ConfigGlobal.SettingConfig.Setting_ConnectionString = txtConnectionString.Text.Trim();
                ConfigGlobal.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserID == -1)
            {
                phAnonymous.Visible = true;
            }
            else
            {
                phAnonymous.Visible = false;
            }

            if (ConfigGlobal.IsPluginAdmin(UserID))
            {
                pnlFuncLink.Visible = true;
            }
            else
            {
                pnlFuncLink.Visible = false;
            }
        }
Пример #17
0
        public static ConfigGlobal readConfig()
        {
            if (File.Exists(confFile))
            {
                Configuracion = Serializador.deserializar <ConfigGlobal>(confFile);
            }
            else
            if (Configuracion == null)
            {
                Configuracion         = new ConfigGlobal();
                Configuracion.usuario = "postgres";
                Configuracion.host    = "localhost";
                Configuracion.puerto  = "5432";
                //Configuracion.SetPassword("null");
                Configuracion.Reportes = standardReports();
                Serializador.serializar <ConfigGlobal>(Configuracion, confFile);
            }

            return(Configuracion);
        }
Пример #18
0
        public JsonResult Config(string key, string value)
        {
            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
            {
                var config = _repo.Single <Config>(x => x.ConfigKey == key && x.ConfigSystem == ConfigSystem.Reservation.ToString());

                if (config != null)
                {
                    config.ConfigValue = value;

                    config.Save();

                    ConfigGlobal.Refresh();
                    ConfigGlobalSecureNode.Refresh();

                    return(Json("Success"));
                }
            }

            return(Json("Failed"));
        }
Пример #19
0
        /// <summary>
        /// Method to load default values
        /// </summary>
        private void LoadDefaultValues()
        {
            ConfigGlobal.Init();

            txtLinkMapEntity.Text = ConfigGlobal.SettingConfig.Setting_EntityPath;
            txtCatalog.Text       = ConfigGlobal.SettingConfig.Database_Catalog;
            txtSqlServer.Text     = ConfigGlobal.SettingConfig.DataBase_SqlServer;
            rbtnSqlServerAuthentication.Checked = ConfigGlobal.SettingConfig.Database_SqlAuthentication;


            if (rbtnSqlServerAuthentication.Checked)
            {
                txtPassword.Text = ConfigGlobal.SettingConfig.Database_Password;
                txtLogin.Text    = ConfigGlobal.SettingConfig.Database_UserName;
            }
            else
            {
                txtPassword.Text = "";
                txtLogin.Text    = "";
            }
        }
Пример #20
0
        public void Execute(object state)
        {
            var logInfo = new LogInfo
            {
                MethodInstance = MethodBase.GetCurrentMethod(),
                ThreadInstance = Thread.CurrentThread
            };

            //string _scheduleType = this.GetType().DeclaringType.FullName;

            try
            {
                _log.Info("Scheduler Start: (RefreshCache)", logInfo);

                Config.UpdateAssemblyInfo(Assembly.GetExecutingAssembly(), ConfigSystem.iArsenal);

                ConfigGlobal.Refresh();

                Arsenal_Match.Cache.RefreshCache();
                Arsenal_Player.Cache.RefreshCache();
                Arsenal_Team.Cache.RefreshCache();

                MatchTicket.Cache.RefreshCache();
                Member.Cache.RefreshCache();
                Product.Cache.RefreshCache();
                Showcase.Cache.RefreshCache();

                // Clean Log
                Log.Clean();

                // Clean QrCode Files
                CleanQrCodeFiles();

                _log.Info("Scheduler End: (RefreshCache)", logInfo);
            }
            catch (Exception ex)
            {
                _log.Warn(ex, logInfo);
            }
        }
Пример #21
0
        public JsonResult Config(string key, string value)
        {
            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
            {
                using (IRepository repo = new Repository())
                {
                    var config = repo.Single <Config>(x => x.ConfigKey == key);

                    if (config != null)
                    {
                        config.ConfigValue = value;

                        repo.Save(config);

                        ConfigGlobal.Refresh();

                        return(Json("Success"));
                    }
                }
            }

            return(Json("Failed"));
        }
Пример #22
0
        protected void btnRefreshCache_Click(object sender, EventArgs e)
        {
            try
            {
                ConfigGlobal.Refresh();

                Arsenal_Match.Cache.RefreshCache();
                Arsenal_Player.Cache.RefreshCache();
                Arsenal_Team.Cache.RefreshCache();

                MatchTicket.Cache.RefreshCache();
                Member.Cache.RefreshCache();
                Product.Cache.RefreshCache();
                Showcase.Cache.RefreshCache();

                ClientScript.RegisterClientScriptBlock(typeof(string), "succeed",
                                                       "alert('更新全部缓存成功');window.location.href=window.location.href", true);
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "failed", $"alert('{ex.Message}');", true);
            }
        }
Пример #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_userId > 0)
            {
                pnlAnonymousUser.Visible = false;
                pnlLoginUser.Visible     = true;

                var m = Member.Cache.LoadByAcnID(_userId);

                if (m != null && m.ID > 0)
                {
                    lblUserInfo.Text = $"欢迎访问,<b>{m.Name}</b> (<em>NO.{m.ID}</em>)";
                }
                else
                {
                    lblUserInfo.Text = $"欢迎访问,<b>{_userName}</b> (<em>ID.{_userId}</em>)";
                }

                if (ConfigGlobal.IsPluginAdmin(_userId))
                {
                    ltrlAdminConfig.Text = "<a href=\"AdminConfig.aspx\" target=\"_blank\">后台管理</a> - ";
                }
                else
                {
                    ltrlAdminConfig.Visible = false;
                }
            }
            else
            {
                pnlAnonymousUser.Visible = true;
                pnlLoginUser.Visible     = false;

                hlLogin.NavigateUrl =
                    $"{ConfigGlobal.APILoginURL}?api_key={ConfigGlobal.APIAppKey}&next={Request.Url.PathAndQuery}";
            }
        }
Пример #24
0
        public void Execute(object state)
        {
            var logInfo = new LogInfo
            {
                MethodInstance = MethodBase.GetCurrentMethod(),
                ThreadInstance = Thread.CurrentThread
            };

            try
            {
                _log.Info("Scheduler Start: (RefreshCache)", logInfo);

                Config.UpdateAssemblyInfo(Assembly.GetExecutingAssembly(), ConfigSystem.Reservation);

                ConfigGlobal.Refresh();
                ConfigGlobalSecureNode.Refresh();

                Delivery.Cache.RefreshCache();
                Menu.Cache.RefreshCache();

                // 删除30天前的无效订单记录
                Order.Clean(-30);

                OperationStandard.Cache.RefreshCache();
                OperationStandardDto.Cache.RefreshCache();

                // 删除30天前的无效安全检查记录
                CheckList.Clean(-30);

                _log.Info("Scheduler End: (RefreshCache)", logInfo);
            }
            catch (Exception ex)
            {
                _log.Warn(ex, logInfo);
            }
        }
Пример #25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="transaction"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        private async Task <TransactionResult> ChargeBackTransactionAsync(Transaction transaction, Domain.Enums.TransactionType action)
        {
            try
            {
                string provider;
                var    order = await TransactionDB.GetLogTransactionByOrderIdAsync(transaction.OrderId);

                //
                switch (Enum.Parse(typeof(Domain.Enums.PaymentType), order.PaymentType))
                {
                case Domain.Enums.PaymentType.CreditCard:
                    provider = ConfigGlobal.GetValue("Payment", "CreditCardProvider").ToLower();
                    break;

                case Domain.Enums.PaymentType.DebitCard:
                    provider = ConfigGlobal.GetValue("Payment", "DebitCardProvider").ToLower();
                    break;

                default:
                    throw new Exception("Payment type not set");
                }
                //
                switch (provider)
                {
                case "cielo":
                    return(await CieloProviderAsync(transaction, action));

                default:
                    throw new Exception("Provider not set");
                }
            }
            catch
            {
                throw;
            }
        }
        private void InitForm()
        {
            try
            {
                lblMemberName.Text = $"<b>{MemberName}</b> (<em>NO.{Mid}</em>)";

                if (OrderID > 0)
                {
                    var o = (OrdrTravel)Order.Select(OrderID);

                    if (ConfigGlobal.IsPluginAdmin(Uid) && o != null)
                    {
                        lblMemberName.Text = $"<b>{o.MemberName}</b> (<em>NO.{o.MemberID}</em>)";
                    }
                    else
                    {
                        if (o == null || !o.MemberID.Equals(Mid) || !o.IsActive)
                        {
                            throw new Exception("此订单无效或非当前用户订单");
                        }
                    }

                    #region Bind OrderView Status Workflow

                    if (ucPortalWorkflowInfo != null)
                    {
                        ucPortalWorkflowInfo.JSONOrderStatusList = $"[ {string.Join(",", o.StatusWorkflowInfo)} ]";
                        ucPortalWorkflowInfo.CurrOrderStatus     = o.Status;
                    }

                    #endregion

                    var m = repo.Single <Member>(o.MemberID);

                    lblOrderMobile.Text = $"<em>{o.Mobile}</em>";

                    #region Set Member Nation & Region

                    if (!string.IsNullOrEmpty(m.Nation))
                    {
                        if (m.Nation.Equals("中国"))
                        {
                            lblMemberRegion.Text = "中国 ";

                            var region    = m.Region.Split('|');
                            var _regionID = int.MinValue;

                            for (var i = 0; i < region.Length; i++)
                            {
                                if (int.TryParse(region[i], out _regionID))
                                {
                                    lblMemberRegion.Text += DictionaryItem.Cache.Load(_regionID).Name + " ";
                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            lblMemberRegion.Text = m.Nation;
                        }
                    }
                    else
                    {
                        lblMemberRegion.Text = "无";
                    }

                    #endregion

                    lblMemberIDCardNo.Text     = m.IDCardNo;
                    lblMemberPassportNo.Text   = m.PassportNo;
                    lblMemberPassportName.Text = m.PassportName;
                    lblMemberQQ.Text           = $"<em>{m.QQ}</em>";
                    lblMemberEmail.Text        = $"<em>{m.Email}</em>";

                    lblOrderID.Text          = $"<em>{o.ID}</em>";
                    lblOrderCreateTime.Text  = o.CreateTime.ToString("yyyy-MM-dd HH:mm");
                    lblOrderDescription.Text = o.Description;

                    if (!string.IsNullOrEmpty(o.Remark))
                    {
                        lblOrderRemark.Text   = o.Remark.Replace("\r\n", "<br />");
                        phOrderRemark.Visible = true;
                    }
                    else
                    {
                        phOrderRemark.Visible = false;
                    }

                    // Should be Calculator in this Page
                    var price     = default(double);
                    var priceInfo = string.Empty;

                    var oiLondon = o.OITravelPlan.MapTo <OrdrItmTravelPlan, OrdrItmTravelPlanLondon>();
                    oiLondon.Init();

                    if (oiLondon.IsActive)
                    {
                        // Set Order Travel Date
                        lblOrderItem_TravelInfo.Text =
                            $"希望在 <em>{oiLondon.TravelFromDate.ToString("yyyy年MM月dd日")}</em> 至 <em>{oiLondon.TravelToDate.ToString("yyyy年MM月dd日")}</em> 出行";

                        // Set Order Travel Option
                        if (oiLondon.TravelOption != null && oiLondon.TravelOption.Length > 0)
                        {
                            var _strTravelOption = string.Join("|", oiLondon.TravelOption);

                            _strTravelOption = _strTravelOption.Replace("FLIGHT", "统一预订航班");
                            _strTravelOption = _strTravelOption.Replace("HOTEL", "统一预订住宿");
                            _strTravelOption = _strTravelOption.Replace("MATCHDAY", "参加比赛日活动");
                            _strTravelOption = _strTravelOption.Replace("LONDON", "参加伦敦游");
                            _strTravelOption = _strTravelOption.Replace("MUSEUM", "参观球场和博物馆");

                            lblOrderItem_TravelOption.Text = _strTravelOption;
                        }
                        else
                        {
                            lblOrderItem_TravelOption.Text = "无";
                        }
                    }
                    else
                    {
                        throw new Exception("此订单未填写观赛信息");
                    }

                    // Set Travel Partner
                    var listPartner = o.OITravelPartnerList.FindAll(oi =>
                                                                    oi.IsActive && oi.Partner != null);

                    if (listPartner != null && listPartner.Count > 0)
                    {
                        var oiPartner = listPartner[0];
                        var pa        = oiPartner.Partner;

                        if (pa != null)
                        {
                            var _strParterRelation = "({0})";
                            if (pa.Relation.Equals(1))
                            {
                                _strParterRelation = string.Format(_strParterRelation, "亲属");
                            }
                            else if (pa.Relation.Equals(2))
                            {
                                _strParterRelation = string.Format(_strParterRelation, "朋友");
                            }
                            else
                            {
                                _strParterRelation = string.Empty;
                            }

                            lblOrderItem_TravelPartner.Text = string.Format("<em>{0}</em>{5},{1},{2};护照:({3}){4}",
                                                                            pa.Name, pa.Gender ? "男" : "女", pa.IDCardNo, pa.PassportNo, pa.PassportName,
                                                                            _strParterRelation);
                        }

                        phOrderPartner.Visible = true;
                    }
                    else
                    {
                        phOrderPartner.Visible = false;
                    }

                    // Set Travel Price

                    if (listPartner != null && listPartner.Count > 0)
                    {
                        var oiPartner = listPartner[0];

                        price     = oiPartner.TotalPrice + oiLondon.TotalPrice;
                        priceInfo =
                            $"观赛团预订定金:{oiLondon.TotalPrice.ToString("f0")}+ 同伴定金:{oiPartner.TotalPrice.ToString("f0")} = <em>{price.ToString("f2")}</em>元 (CNY)";

                        phOrderPrice.Visible = true;
                    }
                    else
                    {
                        price     = oiLondon.TotalPrice;
                        priceInfo = $"观赛团预订定金:<em>{price.ToString("f2")}</em>元 (CNY)";

                        phOrderPrice.Visible = true;
                    }

                    tbOrderPrice.Text  = price.ToString();
                    lblOrderPrice.Text = priceInfo;

                    if (o.Status.Equals(OrderStatusType.Draft))
                    {
                        btnSubmit.Visible = true;
                        btnModify.Visible = true;
                        btnCancel.Visible = true;

                        phOrderPrice.Visible = false;
                    }
                    else if (o.Status.Equals(OrderStatusType.Submitted))
                    {
                        btnSubmit.Visible = false;
                        btnModify.Visible = false;
                        btnCancel.Visible = true;

                        phOrderPrice.Visible = false;
                    }
                    else
                    {
                        btnSubmit.Visible = false;
                        btnModify.Visible = false;
                        btnCancel.Visible = false;
                    }
                }
                else
                {
                    throw new Exception("此订单不存在");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "failed",
                                                       $"alert('{ex.Message}');window.location.href = 'iArsenalOrder.aspx'", true);
            }
        }
        private void InitForm()
        {
            try
            {
                lblMemberName.Text = $"<b>{MemberName}</b> (<em>NO.{Mid}</em>)";

                if (OrderID > 0)
                {
                    var o = (OrdrReplicaKit)Order.Select(OrderID);

                    // Whether Home or Away ReplicaKit
                    OrderItem oiReplicaKit;

                    if (o.OIReplicaKitHome != null && o.OIReplicaKitHome.IsActive)
                    {
                        oiReplicaKit = o.OIReplicaKitHome;
                    }
                    else if (o.OIReplicaKitCup != null && o.OIReplicaKitCup.IsActive)
                    {
                        oiReplicaKit = o.OIReplicaKitCup;
                    }
                    else if (o.OIReplicaKitAway != null && o.OIReplicaKitAway.IsActive)
                    {
                        oiReplicaKit = o.OIReplicaKitAway;
                    }
                    else
                    {
                        throw new Exception("此订单未购买球衣商品");
                    }

                    if (ConfigGlobal.IsPluginAdmin(Uid))
                    {
                        lblMemberName.Text = $"<b>{o.MemberName}</b> (<em>NO.{o.MemberID}</em>)";
                    }
                    else
                    {
                        if (!o.MemberID.Equals(Mid) || !o.IsActive)
                        {
                            throw new Exception("此订单无效或非当前用户订单");
                        }
                    }

                    #region Bind OrderView Status Workflow

                    if (ucPortalWorkflowInfo != null)
                    {
                        ucPortalWorkflowInfo.JSONOrderStatusList = $"[ {string.Join(",", o.StatusWorkflowInfo)} ]";
                        ucPortalWorkflowInfo.CurrOrderStatus     = o.Status;
                    }

                    #endregion

                    lblOrderMobile.Text = $"<em>{o.Mobile}</em>";
                    //lblOrderPayment.Text = o.PaymentInfo;
                    lblOrderAddress.Text     = o.Address;
                    lblOrderDescription.Text = o.Description;
                    lblOrderID.Text          = $"<em>{o.ID}</em>";
                    lblOrderCreateTime.Text  = o.CreateTime.ToString("yyyy-MM-dd HH:mm");

                    if (!string.IsNullOrEmpty(o.Remark))
                    {
                        lblOrderRemark.Text   = o.Remark.Replace("\r\n", "<br />");
                        phOrderRemark.Visible = true;
                    }
                    else
                    {
                        phOrderRemark.Visible = false;
                    }

                    // Should be Calculator in this Page
                    double price;
                    string priceInfo;

                    var oiNumber = o.OIPlayerNumber;
                    var oiName   = o.OIPlayerName;
                    var oiFont   = o.OIArsenalFont;

                    var oiPremierPatch  = o.OIPremiershipPatch;
                    var oiChampionPatch = o.OIChampionshipPatch;

                    lblOrderItem_ReplicaKit.Text     = $"<em>{oiReplicaKit.ProductName}</em>";
                    lblOrderItem_ReplicaKitSize.Text = oiReplicaKit.Size;

                    price     = oiReplicaKit.TotalPrice;
                    priceInfo = $"<合计> 球衣:{oiReplicaKit.TotalPrice.ToString("f2")}";

                    if (oiNumber != null && oiNumber.IsActive && oiName != null && oiName.IsActive)
                    {
                        if (oiFont != null && oiFont.IsActive)
                        {
                            lblOrderItem_PlayerDetail.Text =
                                $"{oiName.PrintingName} ({oiNumber.PrintingNumber}) <em>【{Product.Cache.Load(oiFont.ProductGuid).DisplayName}】</em>";

                            price     += oiFont.TotalPrice;
                            priceInfo += $" + 印字号(特殊):{oiFont.TotalPrice.ToString("f2")}";
                        }
                        else
                        {
                            lblOrderItem_PlayerDetail.Text = $"{oiName.PrintingName} ({oiNumber.PrintingNumber})";

                            price     += oiNumber.TotalPrice + oiName.TotalPrice;
                            priceInfo += $" + 印字号:{(oiNumber.TotalPrice + oiName.TotalPrice).ToString("f2")}";
                        }
                    }
                    else
                    {
                        lblOrderItem_PlayerDetail.Text = "无";
                    }

                    if (oiPremierPatch != null && oiPremierPatch.IsActive && oiChampionPatch != null &&
                        oiChampionPatch.IsActive)
                    {
                        lblOrderItem_Patch.Text = $"{oiPremierPatch.ProductName} | {oiChampionPatch.ProductName}";
                        price     += (oiPremierPatch.TotalPrice + oiChampionPatch.TotalPrice);
                        priceInfo += $" + 袖标:{(oiPremierPatch.TotalPrice + oiChampionPatch.TotalPrice).ToString("f2")}";
                    }
                    else if (oiPremierPatch != null && oiPremierPatch.IsActive && oiChampionPatch == null)
                    {
                        lblOrderItem_Patch.Text = $"{oiPremierPatch.ProductName} × {oiPremierPatch.Quantity}";
                        price     += oiPremierPatch.TotalPrice;
                        priceInfo +=
                            $" + 袖标:{oiPremierPatch.UnitPrice.ToString("f2")}×{oiPremierPatch.Quantity}";
                    }
                    else if (oiPremierPatch == null && oiChampionPatch != null && oiChampionPatch.IsActive)
                    {
                        lblOrderItem_Patch.Text =
                            $"{oiChampionPatch.ProductName} × {oiChampionPatch.Quantity}";
                        price     += oiChampionPatch.TotalPrice;
                        priceInfo +=
                            $" + 袖标:{oiChampionPatch.UnitPrice.ToString("f2")}×{oiChampionPatch.Quantity}";
                    }
                    else
                    {
                        lblOrderItem_Patch.Text = "无";
                    }

                    if (o.Postage > 0)
                    {
                        price     += o.Postage;
                        priceInfo += $" + 快递费:{o.Postage.ToString("f2")}";
                    }

                    if (!o.Sale.HasValue)
                    {
                        lblOrderPrice.Text = $"{priceInfo} = <em>{price.ToString("f2")}</em>元 (CNY)";
                    }
                    else
                    {
                        lblOrderPrice.Text =
                            $"{priceInfo} = <em>{price.ToString("f2")}</em>元<br /><结算价>:<em>{o.Sale.Value.ToString("f2")}</em>元 (CNY)";
                    }

                    tbOrderPrice.Text = price.ToString(CultureInfo.CurrentCulture);

                    if (o.Status.Equals(OrderStatusType.Draft))
                    {
                        btnSubmit.Visible = true;
                        btnModify.Visible = true;
                        btnCancel.Visible = true;
                    }
                    else if (o.Status.Equals(OrderStatusType.Submitted))
                    {
                        btnSubmit.Visible = false;
                        btnModify.Visible = false;
                        btnCancel.Visible = true;

                        if (string.IsNullOrEmpty(o.Remark))
                        {
                            lblOrderRemark.Text   = "<em>请尽快按右侧提示框的付款方式进行球衣全额支付。--><br />我们会在收到您的款项后,为您安排确认并下单。</em>";
                            phOrderRemark.Visible = true;
                        }

                        ucPortalProductQrCode.QrCodeUrl      = "~/UploadFiles/qrcode-alipay-vicky.png";
                        ucPortalProductQrCode.QrCodeProvider = "支付宝";
                        ucPortalProductQrCode.IsLocalUrl     = true;
                    }
                    else
                    {
                        btnSubmit.Visible = false;
                        btnModify.Visible = false;
                        btnCancel.Visible = false;
                    }
                }
                else
                {
                    throw new Exception("此订单不存在");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "failed",
                                                       $"alert('{ex.Message}');window.location.href = 'iArsenalOrder.aspx'", true);
            }
        }
Пример #28
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (todosCamposCompletos())
         {
             Usuario usuario = new Usuario();
             if (rolLogueado != "sin Rol")
             {
                 usuario.username  = textNroIdentificacion.Text;
                 usuario.password  = textNroIdentificacion.Text;
                 usuario.creadoPor = "admin";
             }
             else
             {
                 usuario.username  = textUsername.Text;
                 usuario.password  = textPassword.Text;
                 usuario.creadoPor = "cliente";
             }
             //Carga de datos
             Domicilio    dire            = new Domicilio();
             Cliente      cli             = new Cliente();
             Tarjeta      tar             = new Tarjeta();
             ConfigGlobal archivoDeConfig = new ConfigGlobal();
             cli.apellido             = textApellido.Text;
             cli.nombre               = textNombre.Text;
             cli.tipoDocumento        = txtTipoDoc.Text;
             cli.numeroDocumento      = int.Parse(textNroIdentificacion.Text);
             cli.mail                 = textMail.Text;
             cli.fechaNacimiento      = dateTimePickerFechaNac.Value;
             cli.cuil                 = textCUIL.Text;
             cli.telefono             = int.Parse(textTelefono.Text);
             usuario.fechaCreacionPsw = archivoDeConfig.getFechaSistema();
             dire.calle               = textDireccion.Text;
             dire.piso                = int.Parse(textPiso.Text);
             dire.dpto                = textDepto.Text;
             dire.localidad           = textLocalidad.Text;
             dire.cp              = int.Parse(textCP.Text);
             dire.numero          = int.Parse(txtNro.Text);
             cli.Cli_Dir          = dire;
             usuario.cliente      = cli;
             tar.propietario      = txtTarjProp.Text;
             tar.numero           = txtTarjNum.Text;
             tar.fechaVencimiento = dateTimePickerVenc.Value;
             cli.Cli_Tar          = tar;
             //Alta del cliente
             int resp = usuario.Alta();
             if (resp != 0)
             {
                 MessageBox.Show("Error!. No se ha creado el Usuario.", "Error al crear Nuevo Usuario",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             if (rolLogueado != "sin Rol")
             {
                 MessageBox.Show("Cliente " + textNombre.Text + " creado, tiene hasta el día " + (usuario.fechaCreacionPsw.AddDays(2)) + " Para cambiar la password creada por defecto.", "Usuario Creado",
                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                 limpiar();
             }
             else
             {
                 MessageBox.Show("Cliente " + textNombre.Text + " creado", "Usuario Creado",
                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                 limpiar();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message, "ERROR", MessageBoxButtons.OK);
     }
 }
Пример #29
0
        private bool validarData()
        {
            ConfigGlobal cg = new ConfigGlobal();

            if (radioSi.Checked)
            {
                if (fechasValidas.Count <= 0)
                {
                    MessageBox.Show("Valide las fechas, ya existen otros espectaculos el mismo dia en el mismo horario", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
            }
            if ((dateTimePickerPublicacion.Value) < cg.getFechaSistema())
            {
                MessageBox.Show("La fecha de publicacion debe ser posterior a la fecha del sistema", "¡Error!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (radioNo.Checked)
            {
                if (publicacion.hayAlgunEspectaculoEnEstaFecha(dateTimePickerEspectaculo.Value))
                {
                    MessageBox.Show("Ya existe un espectáculo en esa fecha..", "¡Error!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
            }
            if (radioNo.Checked == false && radioSi.Checked == false)
            {
                MessageBox.Show("Debe seleccionar al menos una opción para la fecha del Espectáculo.", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (textDescripcion.Text == "")
            {
                MessageBox.Show("debe escribir una descripcion", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (textDireccion.Text == "")
            {
                MessageBox.Show("debe escribir una direccion", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (comboGradoPublicacion.SelectedIndex == 0)
            {
                MessageBox.Show("Debe seleccionar un Grado de publicacion", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (comboRubro.SelectedIndex == 0)
            {
                MessageBox.Show("Debe seleccionar un Rubro.", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (textStock.Text == "")
            {
                MessageBox.Show("Ingrese algún stock.", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (textStock.Text == "")
            {
                MessageBox.Show("Ingrese algún stock.", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (int.Parse(textStock.Text.ToString()) > 100)
            {
                MessageBox.Show("La máxima cantidad de stock es 100", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (int.Parse(textStock.Text.ToString()) <= 0)
            {
                MessageBox.Show("La mínima cantidad de stock es 10", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (int.Parse(textStock.Text.ToString()) % 10 != 0)
            {
                MessageBox.Show("El stock debe ser múltiplo de 10", "¡Advertencia!",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            //if (publicacion.existeFechayHoraSinLote())
            //{
            //	MessageBox.Show("Ya existe un espectaculo en esa fecha y hora, ingrese otra.", "¡Error!",
            //					MessageBoxButtons.OK, MessageBoxIcon.Error);
            //	return false;
            //}

            return(true);
        }
        private void InitForm()
        {
            try
            {
                lblMemberName.Text    = $"<b>{MemberName}</b> (<em>NO.{Mid}</em>)";
                lblMemberACNInfo.Text = $"<b>{Username}</b> (<em>ID.{Uid}</em>)";

                var pETPL = Product.Cache.Load("iETPL");
                var pETPA = Product.Cache.Load("iETPA");

                if (pETPL == null || pETPA == null)
                {
                    throw new Exception("无相关商品信息,请联系管理员");
                }

                if (OrderID > 0)
                {
                    var o = (OrdrTravel)Order.Select(OrderID);

                    if (o == null || !o.IsActive)
                    {
                        throw new Exception("此订单无效");
                    }

                    if (ConfigGlobal.IsPluginAdmin(Uid) || o.MemberID.Equals(Mid))
                    {
                        lblMemberName.Text = $"<b>{o.MemberName}</b> (<em>NO.{o.MemberID}</em>)";

                        var m = repo.Single <Member>(o.MemberID);

                        if (m == null || !m.IsActive)
                        {
                            throw new Exception("无此会员信息");
                        }
                        lblMemberACNInfo.Text = $"<b>{m.AcnName}</b> (<em>ID.{m.AcnID}</em>)";

                        #region Set Member Nation & Region

                        if (!string.IsNullOrEmpty(m.Nation))
                        {
                            if (m.Nation.Equals("中国"))
                            {
                                ddlNation.SelectedValue = m.Nation;

                                var region = m.Region.Split('|');
                                if (region.Length > 1)
                                {
                                    tbRegion1.Text = region[0];
                                    tbRegion2.Text = region[1];
                                }
                                else
                                {
                                    tbRegion1.Text = region[0];
                                    tbRegion2.Text = string.Empty;
                                }
                            }
                            else
                            {
                                ddlNation.SelectedValue = "其他";
                                if (m.Nation.Equals("其他"))
                                {
                                    tbNation.Text = string.Empty;
                                }
                                else
                                {
                                    tbNation.Text = m.Nation;
                                }
                            }
                        }
                        else
                        {
                            ddlNation.SelectedValue = string.Empty;
                        }

                        #endregion

                        tbIDCardNo.Text     = m.IDCardNo;
                        tbPassportNo.Text   = m.PassportNo;
                        tbPassportName.Text = m.PassportName;
                        tbMobile.Text       = m.Mobile;
                        tbQQ.Text           = m.QQ;
                        tbEmail.Text        = m.Email;

                        tbOrderDescription.Text = o.Description;
                    }
                    else
                    {
                        throw new Exception("此订单非当前用户订单");
                    }

                    var oiTP = o.OITravelPlan.MapTo <OrdrItmTravelPlan, OrdrItmTravelPlanLondon>();
                    oiTP.Init();

                    var listPartner = o.OITravelPartnerList.FindAll(oi =>
                                                                    oi.IsActive && !string.IsNullOrEmpty(oi.Remark));

                    if (oiTP != null && oiTP.IsActive)
                    {
                        // Set Order Travel Date
                        tbFromDate.Text = oiTP.TravelFromDate.ToString("yyyy-MM-dd");
                        tbToDate.Text   = oiTP.TravelToDate.ToString("yyyy-MM-dd");

                        // Set Order Travel Option
                        for (var j = 0; j < cblTravelOption.Items.Count; j++)
                        {
                            cblTravelOption.Items[j].Selected = false;
                        }

                        if (oiTP.TravelOption != null && oiTP.TravelOption.Length > 0)
                        {
                            for (var i = 0; i < oiTP.TravelOption.Length; i++)
                            {
                                cblTravelOption.Items.FindByValue(oiTP.TravelOption[i]).Selected = true;
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("此订单未填写观赛信息");
                    }

                    if (listPartner != null && listPartner.Count > 0)
                    {
                        cbPartner.Checked = true;

                        var pa = listPartner[0].Partner;

                        if (pa != null)
                        {
                            tbPartnerName.Text = pa.Name;
                            ddlPartnerRelation.SelectedValue = pa.Relation.ToString();
                            rblPartnerGender.SelectedValue   = pa.Gender.ToString().ToLower();
                            tbPartnerIDCardNo.Text           = pa.IDCardNo;
                            tbPartnerPassportNo.Text         = pa.PassportNo;
                            tbPartnerPassportName.Text       = pa.PassportName;

                            cbPartner.Checked = true;
                        }
                        else
                        {
                            cbPartner.Checked = false;
                        }
                    }
                    else
                    {
                        cbPartner.Checked = false;
                    }
                }
                else
                {
                    //Fill Member draft information into textbox
                    var m = repo.Single <Member>(Mid);

                    #region Set Member Nation & Region

                    if (!string.IsNullOrEmpty(m.Nation))
                    {
                        if (m.Nation.Equals("中国"))
                        {
                            ddlNation.SelectedValue = m.Nation;

                            var region = m.Region.Split('|');
                            if (region.Length > 1)
                            {
                                tbRegion1.Text = region[0];
                                tbRegion2.Text = region[1];
                            }
                            else
                            {
                                tbRegion1.Text = region[0];
                                tbRegion2.Text = string.Empty;
                            }
                        }
                        else
                        {
                            ddlNation.SelectedValue = "其他";
                            if (m.Nation.Equals("其他"))
                            {
                                tbNation.Text = string.Empty;
                            }
                            else
                            {
                                tbNation.Text = m.Nation;
                            }
                        }
                    }
                    else
                    {
                        ddlNation.SelectedValue = string.Empty;
                    }

                    #endregion

                    tbIDCardNo.Text     = m.IDCardNo;
                    tbPassportNo.Text   = m.PassportNo;
                    tbPassportName.Text = m.PassportName;
                    tbMobile.Text       = m.Mobile;
                    tbQQ.Text           = m.QQ;
                    tbEmail.Text        = m.Email;
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "failed",
                                                       $"alert('{ex.Message}');window.location.href = 'Default.aspx'", true);
            }
        }