예제 #1
0
        public static int DeleteData(Category categoryModel)
        {
            int    returnCode = 0;
            string constr     = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

            using (MySqlConnection con = new MySqlConnection(constr))
            {
                StringBuilder strQuery = new StringBuilder("DELETE FROM product_category WHERE id='" + categoryModel.ID + "' ");
                using (MySqlCommand cmd = new MySqlCommand(strQuery.ToString(), con))
                {
                    con.Open();
                    cmd.ExecuteNonQuery();
                }
            }


            UpdateDataAfterDeleted(CommonMethod.ParseInt32(categoryModel.ID.ToString()));
            return(returnCode);
        }
예제 #2
0
        public IActionResult Create([FromBody] Bill item)
        {
            passport = CommonMethod.GetPassport(Request);
            if (item == null)
            {
                return(BadRequest());
            }
            Object addResult = service.Add(passport, item);

            if (addResult.GetType().ToString() == "DgWebAPI.Model.Bill")
            {
                ResultModel result = new ResultModel(true, (Bill)addResult);
                return(new ObjectResult(result));
            }
            else
            {
                return(new ObjectResult(addResult.ToString()));
            }
        }
예제 #3
0
        /// <summary>
        /// 根据公司取得公司开通的项目
        /// </summary>
        /// <param name="strCompanyCode"></param>
        /// <returns></returns>
        public static DataTable GetCompanyProjects(string strCompanyCode)
        {
            DataTable dt     = null;
            string    strSql = "SELECT PROJECTIDS FROM USER_SHARE_COMPANYRELATE WHERE COMPANYCODE=:COMPANYCODE ";
            ParamList param  = new ParamList();

            param["COMPANYCODE"] = strCompanyCode;
            string strProjectIds = CommonMethod.FinalString(StaticConnectionProvider.ExecuteScalar(strSql, param));

            if (strProjectIds.Length > 0)
            {
                strProjectIds = strProjectIds.TrimStart(',').TrimEnd(',');
                strSql        = "SELECT PROJECTID,PROJECTNAME FROM USER_SHARE_PROJECT WHERE PROJECTID IN(" + strProjectIds + ") AND STATUS=" + ShareEnum.ProjectStatus.Normal.ToString("d");

                dt = StaticConnectionProvider.ExecuteDataTable(strSql);
            }

            return(dt);
        }
예제 #4
0
        public IActionResult RemoveAndReturnProfit([FromBody] DeleteBillGoods item)
        {
            passport = CommonMethod.GetPassport(Request);
            if (item == null)
            {
                return(BadRequest());
            }
            object doResult = service.RemoveAndReturnProfit(passport, item);

            if (doResult.GetType().ToString() == "DgWebAPI.Model.Profit")
            {
                ResultModel result = new ResultModel(true, (Profit)doResult);
                return(new ObjectResult(result));
            }
            else
            {
                return(new ObjectResult(doResult.ToString()));
            }
        }
        private void dgvInventory_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            ST_StockTransactionDetailDto detailDto = dgcInventory.GetFocusedRow <ST_StockTransactionDetailDto>();

            //Set auto value for column No
            dgcInventory.SetRowCellValue(CommonKey.LineNumber, CommonMethod.ParseString(e.RowHandle + 1));

            #region Set validate

            dgcInventory.ClearErrors();

            /// <summary>
            /// Item Code must be fill in
            ///</summary>
            if (string.IsNullOrEmpty(detailDto.ItemCode))
            {
                IvsMessage msg = new IvsMessage(CommonConstantMessage.COM_MSG_REQUIRED, colItemCode.Caption);
                dgcInventory.SetColumnError(colItemCode.FieldName, msg.MessageText);
                return;
            }

            /// <summary>
            /// Quantity must be greater than 0
            ///</summary>
            if (detailDto.Quantity == null || detailDto.Quantity <= 0)
            {
                IvsMessage msg = new IvsMessage(CommonConstantMessage.COM_MSG_REQUIRED, colQuantity.Caption);
                dgcInventory.SetColumnError(colQuantity.FieldName, msg.MessageText);
                return;
            }

            #endregion Set validate

            #region Add new row if focus to last row

            if (dgcInventory.IsFocusedLastRow())
            {
                dgcInventory.AddNewRow();
            }

            #endregion Add new row if focus to last row
        }
예제 #6
0
        public async Task <IActionResult> GetLessonist(JQueryDataTableParamModel param, int GradeId)
        {
            using (var txscope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                try
                {
                    var parameters    = CommonMethod.GetJQueryDatatableParamList(param, GetSortingColumnName(param.iSortCol_0));
                    var searchRecords = new SqlParameter {
                        ParameterName = "@SearchRecords", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output
                    };

                    if (GradeId != 0)
                    {
                        parameters.Parameters.Insert(0, new SqlParameter("@GradeId", SqlDbType.BigInt)
                        {
                            Value = GradeId
                        });
                    }
                    var allList = await _lessonService.GetLessonList(parameters.Parameters.ToArray());

                    var total = allList.FirstOrDefault()?.TotalRecords ?? 0;
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = total,
                        iTotalDisplayRecords = total,
                        aaData = allList
                    }));
                }
                catch (Exception ex)
                {
                    ErrorLog.AddErrorLog(ex, "GetLessonList");
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = 0,
                        iTotalDisplayRecords = 0,
                        aaData = ""
                    }));
                }
            }
        }
        public async Task <IActionResult> GetGradeWiseStudentFilter(JQueryDataTableParamModel param, StudentFilterDto model)
        {
            using (var txscope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                try
                {
                    var parameters = CommonMethod.GetJQueryDatatableParamList(param, GetSortingColumnName(param.iSortCol_0));

                    parameters.Parameters.Insert(0, new SqlParameter("@Fromdate", SqlDbType.DateTime)
                    {
                        Value = Convert.ToDateTime(model.FromDate).ToString("yyyy/MM/dd")
                    });
                    parameters.Parameters.Insert(1, new SqlParameter("@Todate", SqlDbType.DateTime)
                    {
                        Value = Convert.ToDateTime(model.ToDate).ToString("yyyy/MM/dd")
                    });
                    //parameters.Parameters.Insert(2, new SqlParameter("@Ismember", SqlDbType.Bit) { Value = model.IsMember });

                    var allList = await _studentService.GetGradeWiseStudentFilter(parameters.Parameters.ToArray());

                    var total = allList.FirstOrDefault()?.TotalRecords ?? 0;
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = total,
                        iTotalDisplayRecords = total,
                        aaData = allList
                    }));
                }
                catch (Exception ex)
                {
                    ErrorLog.AddErrorLog(ex, "GetGradeWiseStudentFilter");
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = 0,
                        iTotalDisplayRecords = 0,
                        aaData = ""
                    }));
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Select User-Group related informations
        /// </summary>
        /// <param name="htCondition">
        /// Hashtable contain condition to select data from table ms_groupassign
        /// </param>
        /// <param name="dtResult">
        /// DataTable to contain data selected from table ms_groupassign
        /// </param>
        /// <returns>
        /// 0: Search successful
        /// others: Sql Exception
        /// </returns>
        public int SelectGroupByUserId(string userCode, out DataTable dtResult)
        {
            int returnCode = 0;

            dtResult = new System.Data.DataTable();
            using (BaseDao context = new BaseDao())
            {
                try
                {
                    IQueryable <ms_groupsassign> lstItem = context.ms_groupsassign.AsQueryable();

                    if (!CommonMethod.IsNullOrEmpty(userCode))
                    {
                        lstItem = lstItem.Where(ig => ig.UserCode.Equals(userCode));
                    }

                    //if (htCondition[CommonKey.GroupCode] != null && !CommonMethod.IsNullOrEmpty(htCondition[CommonKey.GroupCode]))
                    //{
                    //    string groupCode = htCondition[CommonKey.GroupCode].ToString();
                    //    lstItem = lstItem.Where(ig => ig.GroupCode.Equals(groupCode));
                    //}

                    #region Search data

                    IEnumerable <SYS_GroupsAssignModel> lstResult = lstItem.Select(ig => new SYS_GroupsAssignModel
                    {
                        ID        = ig.ID,
                        UserCode  = ig.UserCode,
                        GroupCode = ig.GroupCode,
                    });

                    dtResult = base.ToDataTable(lstResult);

                    #endregion Search data
                }
                catch (Exception ex)
                {
                    returnCode = this.ProcessDbException(ex);
                }
            }
            return(returnCode);
        }
        public string AddOneByJsonIncludeAudio()
        {
            MessageInfo mi = new MessageInfo();

            mi.State   = "0000";
            mi.Message = "";
            mi.Result  = "false";
            string name = string.Empty;

            try
            {
                //string conferenceName = Context.Request["conferenceName"];
                int    conferenceID = Convert.ToInt32(Context.Request["conferenceID"]);
                string json         = Context.Request["json"];
                name = Context.Request.Files[0].FileName;
                Stream stream = Context.Request.Files[0].InputStream;
                byte[] data   = new byte[stream.Length];
                stream.Read(data, 0, data.Length);
                stream.Dispose();

                string fsName = System.AppDomain.CurrentDomain.BaseDirectory + Constant.AudioLocalRootName + "\\" + name;

                string fsNameUrl = Constant.AudioTempHttp + name;

                using (FileStream fs = File.Create(fsName))
                {
                    fs.Write(data, 0, data.Length);
                }
                //信息添加辅助
                this.AddOneByJsonHelper(conferenceID, json, fsNameUrl);
                mi.Result = "true";
            }
            catch (Exception e)
            {
            }
            Context.Response.ContentType     = "application/json";
            Context.Response.Charset         = Encoding.UTF8.ToString(); //设置字符集类型
            Context.Response.ContentEncoding = System.Text.Encoding.UTF8;
            Context.Response.Write(CommonMethod.Serialize(mi));
            Context.Response.End();
            return(name);
        }
예제 #10
0
        // GET: Login
        public ActionResult Index(string errorStr, bool isAdLogin = true)
        {
            //获取请求使用的语言
            string language = Request.Headers["Accept-Language"].ToString();

            language = language.Split(',')[0].ToString();
            if (language.IndexOf("en") >= 0)
            {
                ViewBag.language = "English";
            }
            else
            {
                ViewBag.language = "Chinese";
            }
            ViewBag.language = language;
            ViewBag.errorStr = errorStr;

            //判断是否存在对应的cookie
            HttpCookie cookie = HttpContext.Request.Cookies["Passport.Token"];

            if (cookie != null)
            {
                return(Redirect("/Home/Index"));
            }

            //判断是否为AD域登陆
            if (isAdLogin)
            {
                string userName = CommonMethod.GetUserLoginName(HttpContext);
                if (!string.IsNullOrEmpty(userName))
                {
                    // 设置用户 cookie
                    HttpCookie createCookie = new HttpCookie("Passport.Token");
                    createCookie.Value   = userName;
                    createCookie.Expires = DateTime.Now.AddHours(8);
                    createCookie.Secure  = FormsAuthentication.RequireSSL;
                    Response.Cookies.Add(createCookie);
                    return(Redirect("/Home/Index"));
                }
            }
            return(View());
        }
예제 #11
0
        //重新生成wap静态页
        protected void btnUpdateWapHtml_Click(object sender, EventArgs e)
        {
            string    sql = "select t_article.*,t_article_type.type_name,t_article_type.id as articleType from t_article left join t_article_type on (t_article.type=t_article_type.id)  ";
            DataTable dt  = artBll.SelectToDataTable(sql);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int    articleId       = Convert.ToInt32(dt.Rows[i]["id"]);
                    string title           = dt.Rows[i]["title"].ToString();
                    string title1          = dt.Rows[i]["title1"].ToString();
                    string source          = dt.Rows[i]["source"].ToString();
                    int    articleType     = Convert.ToInt32(dt.Rows[i]["articleType"]);
                    string articleTypeName = dt.Rows[i]["type_name"].ToString();
                    string content         = dt.Rows[i]["content"].ToString();
                    string keyword         = dt.Rows[i]["keyword"].ToString();
                    string search_keyword  = dt.Rows[i]["search_keyword"].ToString();
                    string artPic          = dt.Rows[i]["pic"].ToString();
                    string article_html    = dt.Rows[i]["html"].ToString();
                    string tagStr          = dt.Rows[i]["tag"].ToString();
                    string tag_id          = dt.Rows[i]["tag_id"].ToString();
                    string tagIdHtml       = "";
                    if (tag_id.Trim() != "")
                    {
                        string[] arrayTag_id = tag_id.Split(',');
                        for (int j = 0; j < arrayTag_id.Length; j++)
                        {
                            if (arrayTag_id[j].Trim() != "," && arrayTag_id[j].Trim() != "")
                            {
                                tagIdHtml = arrayTag_id[j];
                                break;
                            }
                        }
                    }

                    //生成wap版静态页
                    CommonMethod.CreateArticleHtml_Wap(articleId, title, title1, source, articleType, articleTypeName, content, keyword, artPic, article_html, tagStr, tag_id, tagIdHtml, search_keyword);
                }
            }
            InText.AlertAndRedirect("生成成功!", Request.Url.ToString());//刷新当前页
        }
예제 #12
0
        public static void PreProcessFolder(string folderPrefix,
                                            out string entityFolderPath,
                                            out string daoFolderPath,
                                            out string mapperFolderPath,
                                            out string controllerFolderPath,
                                            out string serviceImplFolderPath,
                                            out string serviceInterfaceFolderPath)
        {
            entityFolderPath           = BackendOutputPath + EntityPath + folderPrefix;
            daoFolderPath              = BackendOutputPath + DaoPath + folderPrefix;
            mapperFolderPath           = BackendOutputPath + MapperPath + folderPrefix;
            controllerFolderPath       = BackendOutputPath + ControllerPath + folderPrefix;
            serviceImplFolderPath      = BackendOutputPath + ServiceImplPath + folderPrefix;
            serviceInterfaceFolderPath = BackendOutputPath + ServiceInterfacePath + folderPrefix;

            if (Program.IsOutputToProject)
            {
                entityFolderPath           = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + EntityPath + folderPrefix;
                daoFolderPath              = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + DaoPath + folderPrefix;
                mapperFolderPath           = @"C:\0_Workspace\icts\src\main\resources\" + MapperPath + folderPrefix;
                controllerFolderPath       = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ControllerPath + folderPrefix;
                serviceImplFolderPath      = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ServiceImplPath + folderPrefix;
                serviceInterfaceFolderPath = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ServiceInterfacePath + folderPrefix;
            }

            CommonMethod.CreateDirectoryIfNotExist(entityFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(daoFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(mapperFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(controllerFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(serviceImplFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(serviceInterfaceFolderPath);

            if (!string.IsNullOrEmpty(folderPrefix))
            {
                CommonMethod.ClearFolderIfExistFiles(entityFolderPath);
                CommonMethod.ClearFolderIfExistFiles(daoFolderPath);
                CommonMethod.ClearFolderIfExistFiles(mapperFolderPath);
                CommonMethod.ClearFolderIfExistFiles(controllerFolderPath);
                CommonMethod.ClearFolderIfExistFiles(serviceImplFolderPath);
                CommonMethod.ClearFolderIfExistFiles(serviceInterfaceFolderPath);
            }
        }
예제 #13
0
    protected void btnLogin_Click1(object sender, EventArgs e)
    {
        #region  务器端验证

        if (txtUserName.Text.Trim().Length == 0)
        {
            Alert("请输入您的换客名!");
            Select(txtUserName);
            return;
        }

        if (txtPwd.Text.Trim().Length == 0)
        {
            Alert("请输入您的密码!");
            Select(txtPwd);
            return;
        }


        #endregion

        #region  系统登陆

        if (XiHuan_UserFacade.IsUserValid(txtUserName.Text, txtPwd.Text))
        {
            int      uid = XiHuan_UserFacade.GetIdByName(txtUserName.Text);
            DateTime dt  = DateTime.MinValue;
            if (chkAutoLogin.Checked)
            {
                dt = DateTime.Now.AddDays(14);
            }
            CommonMethod.AddLoginCookie(uid, txtUserName.Text, dt);
            Alert("您已成功登录,请在窗口关闭后继续刚才的操作 ^_^!");
            ExecScript("parent.ymPrompt.close();");
        }
        else
        {
            Alert("换客名或密码不正确,请重试!");
            return;
        }
        #endregion
    }
예제 #14
0
        private static void GenerateEntity(string entityName, Dictionary <string, string> fieldDict)
        {
            StringBuilder entityBuilder = new StringBuilder();

            entityBuilder.AppendLine("package " + Backend_Anchors.EntityPackagePrefix + ";");
            if (entityName == "Anchors")
            {
                entityBuilder.AppendLine("");
                entityBuilder.AppendLine("import java.util.List;");
            }
            entityBuilder.AppendLine("");
            entityBuilder.AppendLine($"public class {entityName} " + "{");
            entityBuilder.AppendLine("");

            foreach (var item in fieldDict)
            {
                var propertyName = CommonMethod.GetFirstUpString(item.Key);
                entityBuilder.AppendLine($"    private {item.Value} {item.Key};");
                entityBuilder.AppendLine("");
                entityBuilder.AppendLine($"    public {item.Value} get{propertyName}() " + "{");
                entityBuilder.AppendLine($"        return {item.Key};");
                entityBuilder.AppendLine("    }");
                entityBuilder.AppendLine("");
                entityBuilder.AppendLine($"    public void set{propertyName}({item.Value} value) " + "{");
                entityBuilder.AppendLine($"        this.{item.Key} = value;");
                entityBuilder.AppendLine("    }");
                entityBuilder.AppendLine("");
            }

            if (entityName == "Anchors")
            {
                entityBuilder.AppendLine("    public Anchors(String name) {");
                entityBuilder.AppendLine("        deviceType = name;");
                entityBuilder.AppendLine("    }");
            }

            entityBuilder.AppendLine("}");
            var content  = entityBuilder.ToString();
            var filePath = _entityFolderPath + $"\\{entityName}.java";

            File.WriteAllText(filePath, content, new UTF8Encoding(false));
        }
예제 #15
0
        private bool CopyMethodFiles(MethodInfo method, string parentDirectory)
        {
            try
            {
                eftir_cls_ident_method cls_method = eftir_cls_ident_method.Deserialize(method.methodFile);
                if (cls_method == null)
                {
                    return(false);
                }

                //拷贝引用的光谱文件
                //会将模型中的数状结构变成平面结构,因此要保证模型中所引用的文件名不相同
                foreach (eftir_cls_ident_method.analyte item in cls_method.analytes)
                {
                    string filename = Path.Combine(parentDirectory, Path.GetFileName(item.filename));
                    File.Copy(item.filename, filename, true);
                    item.filename = filename;   //修改引用文件路径到当前路径
                }
                foreach (eftir_cls_ident_method.interferent item in cls_method.interferents)
                {
                    string filename = Path.Combine(parentDirectory, Path.GetFileName(item.filename));
                    File.Copy(item.filename, filename, true);
                    item.filename = filename;
                }

                //序列化模型文件到当前文件夹
                string clsfile = Path.Combine(parentDirectory, Path.GetFileName(method.methodFile));
                if (!cls_method.Serialize(clsfile))
                {
                    return(false);
                }

                //序列化MethodInfo到当前文件夹
                clsfile = Path.Combine(parentDirectory, "MethodInfo_Temp.methodinfo");      //MethodInfo的内容
                return(method.Serialize(clsfile));
            }
            catch (Exception ex)
            {
                CommonMethod.ErrorMsgBox(ex.Message);
                return(false);
            }
        }
예제 #16
0
        private static void GenerateEntity(string entityFolderPath, HotchnerTable table)
        {
            var           entityName    = Backend_Devices.GetEntityName(table);
            StringBuilder entityBuilder = new StringBuilder();

            entityBuilder.AppendLine("package " + Backend_Devices.EntityPackagePrefix + ";");
            entityBuilder.AppendLine("");
            entityBuilder.AppendLine("import java.sql.Timestamp;");
            entityBuilder.AppendLine("import java.util.Date;");
            entityBuilder.AppendLine("");
            entityBuilder.AppendLine($"public class {entityName} " + "{");

            foreach (var row in table.RowList)
            {
                entityBuilder.AppendLine($"    // {row.Description}");
                entityBuilder.AppendLine($"    private {RowTypeJavaDict[row.RowType]} {row.Name.ToLower()};");
            }
            entityBuilder.AppendLine("");

            foreach (var row in table.RowList)
            {
                string javeType        = RowTypeJavaDict[row.RowType];
                string firstUpOtherLow = CommonMethod.GetFirstUpAndOtherLowString(row.Name);
                string nameLower       = row.Name.ToLower();

                entityBuilder.AppendLine($"    public {javeType} get{firstUpOtherLow}() " + "{");
                entityBuilder.AppendLine($"        return {row.Name.ToLower()};");
                entityBuilder.AppendLine("    }");
                entityBuilder.AppendLine("");
                entityBuilder.AppendLine($"    public void set{firstUpOtherLow}({javeType} {nameLower}) " + "{");
                entityBuilder.AppendLine($"        this.{nameLower} = {nameLower};");
                entityBuilder.AppendLine("    }");
                entityBuilder.AppendLine("");
            }

            entityBuilder.AppendLine("}");

            var content  = entityBuilder.ToString();
            var filePath = entityFolderPath + $"\\{entityName}.java";

            File.WriteAllText(filePath, content, new UTF8Encoding(false));
        }
예제 #17
0
        void resUnit_EditValueChanged(object sender, EventArgs e)
        {
            if (ViewMode == CommonData.Mode.View)
            {
                return;
            }
            LookUpEdit  LookupEdit      = sender as LookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();

            if (SelectedDataRow != null)
            {
                decimal unitPrice = IsMinus ? CommonMethod.ParseDecimal(SelectedDataRow[CommonKey.SalesPrice]) : CommonMethod.ParseDecimal(SelectedDataRow[CommonKey.PurchasePrice]);
                decimal quantity  = CommonMethod.ParseDecimal(dgvAdjustment.GetDataRow(dgvAdjustment.FocusedRowHandle)[CommonKey.InputQuantity]);
                decimal amount    = unitPrice * quantity;
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputUnitPrice, CommonMethod.ParseString(unitPrice));
                dgcAdjustment.SetRowCellValueForBandedGridView(CommonKey.InputAmount, CommonMethod.ParseString(amount));
            }

            dgvAdjustment.PostEditor();
        }
예제 #18
0
        public ActionResult FileManager(string id = "")
        {
            var istdate = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, TimeZoneInfo.Local.Id, "India Standard Time");

            filemanagermodel  objmodel    = new filemanagermodel();
            ManageFileManager filemanager = new ManageFileManager();

            if (id == "")
            {
                objmodel.uploadeddate1 = CommonMethod.ToDDMMYYYY(istdate);
                objmodel.filedate1     = CommonMethod.ToDDMMYYYY(istdate);

                //ViewBag.compid = new SelectList(filemanager.CompList, "compid", "compname");
                //ViewBag.compfinyr = new SelectList(new List<compfinyearlist>(), "compfinid", "finyear");

                //ViewBag.filecatlist = new SelectList(filemanager.FileCatList, "catid", "catname");
                //ViewBag.filesubcat = new SelectList(new List<mstfilesubcategory>(), "subcatid", "subcatname");
            }
            return(View(objmodel));
        }
예제 #19
0
 /// <summary>
 ///     重连模块
 /// </summary>
 private void reconnect()
 {
     if (_reconnectMax == 0)
     {
         return;    //不重连直接返回
     }
     reconnectCi++; //每重连一次重连的次数加1
     if (stateOne != null)
     {
         stateOne.WorkSocket.Close();
         stateOne = null;
     }
     if (reconnectOn == false)
     {
         reconnectOn = true;
         CommonMethod.eventInvoket(() => { ReconnectionStart(); });
     }
     _engineStart = false;
     StartEngine();
 }
예제 #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string action = CommonMethod.FinalString(Request["action"]);
         if (action.Equals("addNewPic"))
         {
             trOldPic.Visible = false;
             btnUpLoad.Text   = " 上传图片 ";
             notice.Visible   = false;
         }
         else if (action.Equals("ModifyPic"))
         {
             OldImage.ImageUrl    = Microsoft.JScript.GlobalObject.unescape(CommonMethod.FinalString(Request["src"]));
             txtImgDesc.Text      = Microsoft.JScript.GlobalObject.unescape(CommonMethod.FinalString(Request["desc"]));
             chkIsDefault.Checked = CommonMethod.FinalString(Request["isdefault"]).Equals("1");
             btnUpLoad.Text       = " 保存修改 ";
         }
     }
 }
예제 #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.Page_Load();
     if (!IsPostBack)
     {
         if (CommonMethod.FinalString(Request["id"]).Length > 0)
         {
             XiHuan_LinksEntity link = new XiHuan_LinksEntity();
             link.Id = CommonMethod.ConvertToInt(Request["id"], 0);
             link.Retrieve();
             if (link.IsPersistent)
             {
                 txtLinkName.Text = CommonMethod.FinalString(link.Name);
                 txtLinkUrl.Text  = CommonMethod.FinalString(link.Url);
                 txtAlt.Text      = CommonMethod.FinalString(link.Alt);
                 txtSort.Text     = CommonMethod.FinalString(link.Sort);
             }
         }
     }
 }
예제 #22
0
    public void PlayAwardVideo(bool isEnd = false)
    {
        float time = _userTurn > 0 ? 2.0f : 0.0f;

        GameManager.instance.ISPLAY = _userTurn > 0 ? false : true;
        StartCoroutine(CommonMethod.WaitTime(time, () =>
        {
            UIManager.Instance.OpenPopup <UIAwardPlayer>(Enums_Common.UIRootType.Screen_Local).PlayeVideo("movie/" + GetAward().ToString(), () =>
            {
                if (isEnd)
                {
                    GameEnd();
                }
                else
                {
                    SetTurnStart();
                }
            });
        }));
    }
예제 #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string type = CommonMethod.FinalString(Request["type"]);

        if (!IsUserAlreadyLogin)
        {
            MemberCenterPageRedirect("", "userequest.aspx?type=" + type);
        }
        if (!IsPostBack)
        {
            if (type == "receive")
            {
                BindReceive();
            }
            else
            {
                BindSend();
            }
        }
    }
예제 #24
0
파일: UcBook.cs 프로젝트: Jackjet/MhczTBG
 /// <summary>
 /// 书本的构造函数(列表构造者)
 /// </summary>
 /// <param name="title">书本的标题</param>
 /// <param name="imageUri">书的背景图</param>
 public UcBook(Microsoft.SharePoint.Client.List list, string imageName)
     : this()
 {
     try
     {
         //生成对象时添加属性值
         this.Title = list.Title;
         //this.ImageUri = imageUri;
         this.List = list;
         BitmapImage imageSource = CommonMethod.GetImageSource(imageName);
         this.TomBook_Loaded(title, imageSource);
     }
     catch (Exception ex)
     {
         MethodLb.CreateLog(this.GetType().FullName, "UcBook", ex.ToString(), list, imageName);
     }
     finally
     {
     }
 }
예제 #25
0
파일: UcBook.cs 프로젝트: Jackjet/MhczTBG
        /// <summary>
        /// 书本的构造函数(文件夹构造者)
        /// </summary>
        /// <param name="title">书本的标题</param>
        /// <param name="imageUri">书的背景图</param>
        public UcBook(Folder forder, string imageName)
            : this()
        {
            try
            {
                //生成对象时添加属性值
                this.Title  = forder.Name;
                this.Folder = forder;

                BitmapImage imageSource = CommonMethod.GetImageSource(imageName);
                this.TomBook_Loaded(title, imageSource);
            }
            catch (Exception ex)
            {
                MethodLb.CreateLog(this.GetType().FullName, "UcBook", ex.ToString(), forder, imageName);
            }
            finally
            {
            }
        }
예제 #26
0
        public void GetTeams()
        {
            string cmd  = "Select * from PartyMaster where deactive=0 and Msrno > " + gMSRNO;
            var    dt   = fetchdata.GetDataTable(cmd);
            var    list = CommonMethod.ConvertToList <PartyMaster>(dt).ToList();

            if (list != null)
            {
                if (list.Count > 0)
                {
                    var totalTeams = list.Count();
                    var greenTeams = list.Where(x => x.ETicket != "0").Count();
                    var redTeams   = list.Where(x => x.ETicket == "0").Count();
                    ViewBag.TotalTeams = totalTeams;
                    ViewBag.Greenteams = greenTeams;
                    ViewBag.Redteams   = redTeams;
                    ViewBag.MyDirect   = list.Where(x => x.SponsorId == gMemberId).Count();
                }
            }
        }
예제 #27
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            IvsMessage message = null;

            if (CommonMethod.IsNullOrEmpty(Code))
            {
                message = new IvsMessage("COM_MSG_MS_DEPARTMENT_CODE");
                yield return(new ValidationResult(message.MessageText, new[] { CommonKey.Code }));
            }
            if (CommonMethod.IsNullOrEmpty(Name1))
            {
                message = new IvsMessage("COM_MSG_MS_DEPARTMENT_NAME1");
                yield return(new ValidationResult(message.MessageText, new[] { CommonKey.Name1 }));
            }
            if (CommonMethod.IsNullOrEmpty(Name2))
            {
                message = new IvsMessage("COM_MSG_MS_DEPARTMENT_NAME2");
                yield return(new ValidationResult(message.MessageText, new[] { CommonKey.Name2 }));
            }
        }
예제 #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load();
        if (!IsPostBack)
        {
            BindNotes(0);
            string action = CommonMethod.FinalString(Request.QueryString["action"]);
            if (action.Length > 0)
            {
                switch (action)
                {
                case "del": DelNotes(Request["id"]); break;

                case "check": CheckNotes(Request["id"], Request["gid"]); break;

                default: break;
                }
            }
        }
    }
예제 #29
0
        protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
        {
            if (modelType.Equals(typeof(IModel)))
            {
                string controllerName = CommonMethod.ParseString(controllerContext.RouteData.Values["controller"]);
                //var modelList = Ivs.Core.Web.Controllers.BaseController.ModelList;
                if (ApplicationState.Contain(controllerName))
                {
                    Type type = ApplicationState.GetValue <Type>(controllerName);
                    if (type != null)
                    {
                        var model = Activator.CreateInstance(type);
                        bindingContext.ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(() => model, type);
                        return(model);
                    }
                }
            }

            return(base.CreateModel(controllerContext, bindingContext, modelType));
        }
예제 #30
0
        public static void Sort(int[] array)
        {
            int n = array.Length;

            //build heap (rearrange array)
            for (int i = n / 2 - 1; i >= 0; i--)
            {
                Heapify(array, n, i);
            }

            //one by one extract an element from heap
            for (int i = n - 1; i > 0; i--)
            {
                //Move current root to end
                CommonMethod.Swap(array, 0, i);

                //call max heapify on the reduced heap
                Heapify(array, i, 0);
            }
        }