コード例 #1
0
        public JsonResult BatchDelete()
        {
            SystemMessages sysMsg = new SystemMessages();
            string categoryName = Request["categoryName"];
            FieldCategory category = new FieldCategory(categoryName);

            using (TScope ts = new TScope())
            {
                try
                {
                    CostingMasterDetailData cmdd = new CostingMasterDetailData(category);
                    cmdd.BatchDelete();
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    sysMsg.isPass = false;
                    sysMsg.Messages.Add("Error", ex.Message);
                }
            }

            var jsonResult = new
            {
                success = sysMsg.isPass,
                errMessage = sysMsg.MessageString
            };
            return Json(jsonResult);
        }
コード例 #2
0
 public static string CreateHiddenFields(FieldCategory category)
 {
     StringBuilder sb = new StringBuilder();
     foreach (FieldInfo f in category.HiddenFields)
     {
         string comVal = UIComponent.GetComponentValue(f);
         sb.AppendFormat("<input class=\"form-field\" type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\" />", f.FieldName, comVal);
     }
     return sb.ToString();
 }
コード例 #3
0
 public CostingMasterDetailData(FieldCategory category, Dictionary<string, object> data)
 {
     this.Category = category;
     this.Params = new TableParams(category.CategoryName);
     foreach (KeyValuePair<string, object> kv in data)
     {
         FieldInfo f = category.Fields[kv.Key];
         if (f != null)
         {
             f.DataValue = kv.Value;
         }
     }
 }
コード例 #4
0
ファイル: SCMPriceMasterDetail.cs プロジェクト: rivernli/SGP
 public SCMPriceMasterDetail(FieldCategory category, Dictionary<string, object> data, string pageType)
 {
     this.Category = category;
     this.pageType = pageType;
     foreach (KeyValuePair<string, object> kv in data)
     {
         FieldInfo f = category.Fields[kv.Key];
         if (f != null)
         {
             f.DataValue = kv.Value;
         }
     }
 }
コード例 #5
0
ファイル: CostingVersionDetail.cs プロジェクト: rivernli/SGP
        public static void CopyVersion(int versionID)
        {
            string strSql = "SELECT * FROM SCM_Version WHERE ID = @ID";
            DataTable dtVersion = DbHelperSQL.Query(strSql, new SqlParameter("@ID", versionID)).Tables[0];
            if (dtVersion.Rows.Count > 0)
            {
                string baseOn = Convert.ToString(dtVersion.Rows[0]["BaseOn"]);
                string version = Convert.ToString(dtVersion.Rows[0]["Version"]);
                if (String.IsNullOrWhiteSpace(baseOn))
                {
                    strSql = "SELECT Version FROM SCM_Version WHERE Status = 'Active'";
                    baseOn = DbHelperSQL.GetSingle<string>(strSql);
                }

                if (!String.IsNullOrWhiteSpace(baseOn))
                {
                    strSql = "SELECT * FROM SCS_TableParams WHERE TableType = 2";
                    DataTable dtTableParams = DbHelperSQL.Query(strSql).Tables[0];
                    foreach (DataRow drTP in dtTableParams.Rows)
                    {
                        FieldCategory fc = new FieldCategory(Convert.ToString(drTP["TableKey"]));
                        string strField = "";
                        foreach (FieldInfo f in fc.Fields)
                        {
                            if (f.Visible != 0 && f.FieldName != "Version")
                            {
                                strField += f.FieldName + ",";
                            }
                        }

                        strField = strField.TrimEnd(',');

                        strSql = String.Format("INSERT INTO {0}(Version,{1}) SELECT @Version,{1} FROM {0} WHERE Version = @BaseOn;", drTP["TableName"], strField);
                        DbHelperSQL.ExecuteSql(strSql, new SqlParameter("@Version", version), new SqlParameter("@BaseOn", baseOn));
                    }
                }
            }
        }
コード例 #6
0
        public JsonResult DelData()
        {
            SystemMessages sysMsg = new SystemMessages();
            int id = 0;
            string dataId = Request["dataId"];
            string categoryName = Request["categoryName"];

            Int32.TryParse(dataId, out id);
            FieldCategory category = new FieldCategory(categoryName);

            using (TScope ts = new TScope())
            {
                try
                {
                    CostingPeriodDetail cpd = new CostingPeriodDetail(category);

                    if (id > 0)
                    {
                        cpd.Delete(id);
                    }
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    sysMsg.isPass = false;
                    sysMsg.Messages.Add("Error", ex.Message);
                }
            }

            var jsonResult = new
            {
                success = sysMsg.isPass,
                errMessage = sysMsg.MessageString
            };
            return Json(jsonResult);
        }
コード例 #7
0
        public ActionResult UploadFile()
        {
            string tableKey = Request["tableKey"];
            string pageType = Request["pageType"];
            HttpPostedFileBase file = Request.Files["Filedata"];
            SystemMessages sysMsg = new SystemMessages();
            using (TScope ts = new TScope())
            {
                try
                {
                    DataSet ds = ExcelHelper.ReadExcel(file.InputStream, true);
                    if (ds.Tables.Count > 0)
                    {
                        DateTime date = DateTime.Now;
                        DataTable dt = ds.Tables[0];
                        FieldCategory fc = new FieldCategory(tableKey, pageType);
                        foreach (DataRow dr in dt.Rows)
                        {
                            fc.ClearAllFieldsData();
                            FieldInfoCollecton fields = fc.VisibleFields;
                            Dictionary<string, object> dicData = new Dictionary<string, object>();
                            foreach (DataColumn dc in dt.Columns)
                            {
                                var fi = fields.Where(p => p.DisplayName == dc.ColumnName).SingleOrDefault();
                                if (fi != null)
                                {
                                    dicData.Add(fi.FieldName, dr[dc.ColumnName]);
                                }
                            }

                            if (dicData.Count == 0)
                            {
                                throw new Exception("Upload Error: can not match data.");
                            }
                            else
                            {
                                SCMPriceMasterDetail smd = new SCMPriceMasterDetail(fc, dicData, pageType);
                                fc.CheckDataType(dicData, sysMsg);
                                smd.CheckData(sysMsg);
                                if (sysMsg.isPass)
                                {
                                    smd.InsertUploadFile(date);
                                }
                                else
                                {
                                    ts.Rollback();
                                    break;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ts.Rollback();
                    sysMsg.isPass = false;
                    sysMsg.Messages.Add("Error", ex.Message);
                }
                var result = new
                {
                    success = sysMsg.isPass,
                    errMessage = sysMsg.MessageString
                };
                return Json(result);
            }
        }
コード例 #8
0
ファイル: CostingOtherDetail.cs プロジェクト: rivernli/SGP
 public CostingOtherDetailData(FieldCategory category, Dictionary<string, object> data)
     : base(category, data)
 {
 }
コード例 #9
0
ファイル: FieldCategory.cs プロジェクト: rivernli/SGP
        public static List<FieldCategory> GetCategoryByName(string categoryNames)
        {
            string strSql = string.Format("SELECT * FROM SYS_FieldCategory WHERE CategoryName IN({0}) ORDER BY Sort", "'" + categoryNames.Replace(",", "','") + "'");
            DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
            List<FieldCategory> list = new List<FieldCategory>();

            foreach (DataRow dr in dt.Rows)
            {
                FieldCategory fc = new FieldCategory();
                fc.FillCategory(dr);
                list.Add(fc);
            }

            return list;
        }
コード例 #10
0
ファイル: FPCUIManager.cs プロジェクト: rivernli/SGP
        private static string GenerateCategoryForVerticalDetail(FieldCategory fc)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@"<table id=""sample-table-1"" class=""table table-striped table-bordered table-hover"">");

            sb.Append(@"<thead><tr>");
            foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields)
            {

                sb.AppendFormat("<td>{0}</td>", fi.DisplayName);

            }
            sb.AppendFormat("<td></td>");
            sb.Append(@"</tr></thead>");
            sb.Append(@"<tbody><tr>");
            foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields)
            {

                sb.AppendFormat("<td>{0}</td>", GenerateFieldforVertical(fi));

            }
            sb.AppendFormat(@"		<td>
                                                            <div class=""visible-md visible-lg hidden-sm hidden-xs btn-group"">
                                                                <button class=""btn btn-xs btn-danger"" onclick=""return RemoveRow(this);"">
                                                                    <i class=""icon-minus bigger-120""></i>
                                                                </button>

                                                                <button class=""btn btn-xs btn-success"" onclick=""return AddRow(this);"">
                                                                    <i class=""icon-plus bigger-120""></i>
                                                                </button>
                                                            </div>
                                                            </div>
                                                        </td>");
            sb.Append(@"</tr></tbody></table>");

            return sb.ToString();
        }
コード例 #11
0
        private static string GenrateCategory(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID)
        {
            StringBuilder sb = new StringBuilder();
            ID++;

            sb.Append(@"<div class=""panel panel-default"">
                           <div class=""panel-heading"">
                              <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle"">
                              <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i>
                              <i class=""icon-user bigger-130""></i>&nbsp; " + fc.CategoryName + @":</a>
                           </div>");
            sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">");

            sb.Append(@"<form id='fm' method='post'><table>");
            FieldInfoCollecton enablefields = new FieldInfoCollecton();

            foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields)
            {
                if (fi.Enable == 1)
                {

                    enablefields.Add(fi);
                }
            }

            double RowCount = enablefields.Count;
            int colSize = 4;
            sb.Append(@"<input type=""hidden"" id=""ID"" name=""ID"" value=""" + ActivityID + @"""  /><tbody  style=""width:100%"">");

            int colSpanTotal = 0;
            for (int i = 0; i < RowCount; i++)
            {
                if (colSpanTotal == 0)
                {
                    sb.Append("<tr>");
                }

                colSpanTotal++;

                int curSpan;
                if (enablefields[i].ColSpan == 0)
                {
                    curSpan = 1;
                }
                else if (enablefields[i].ColSpan > (colSize - 1))
                {
                    curSpan = colSize - 1;
                }
                else
                {
                    curSpan = enablefields[i].ColSpan;
                }
                colSpanTotal += curSpan;

                if (colSpanTotal <= colSize)
                {
                    sb.Append(UIManager.GenerateField(enablefields[i]));
                }

                if (colSpanTotal == colSize)
                {
                    sb.Append("</tr>");
                    colSpanTotal = 0;
                }

                if (colSpanTotal > colSize)
                {
                    sb.Append("</tr>");
                    colSpanTotal = 0;
                    i--;
                }
            }
            sb.Append("</tbody>");
            sb.Append("</form></table>");
            sb.Append(@"</div></div></div>");

            return sb.ToString();
        }
コード例 #12
0
        public JsonResult SaveData()
        {
            SystemMessages sysMsg = new SystemMessages();
            int id = 0;
            string postData = Request["postData"];

            if (!String.IsNullOrWhiteSpace(postData))
            {
                System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                Dictionary<string, object> jsonData = jss.Deserialize<Dictionary<string, object>>(postData) as Dictionary<string, object>;

                string dataId = Convert.ToString(jsonData["dataId"]);
                Int32.TryParse(dataId, out id);
                FieldCategory category = new FieldCategory(Convert.ToString(jsonData["categoryName"]));
                Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>;

                if (id == 0)
                {
                    data["CreatorName"] = AccessControl.CurrentLogonUser.Name;
                    data["CreationTime"] = DateTime.Now;
                }

                using (TScope ts = new TScope())
                {
                    try
                    {
                        CostingPeriodDetail cpd = new CostingPeriodDetail(category, data);
                        category.CheckDataType(data, sysMsg);
                        cpd.CheckData(sysMsg);

                        if (sysMsg.isPass)
                        {
                            if (id > 0)
                            {
                                cpd.Update(id);
                            }
                            else
                            {
                                id = cpd.Add();
                            }

                            if (Convert.ToString(data["Status"]) == "Active")
                            {
                                SetActiveToClose(id);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ts.Rollback();
                        sysMsg.isPass = false;
                        sysMsg.Messages.Add("Error", ex.Message);
                    }
                }
            }

            var jsonResult = new
            {
                DataId = id,
                success = sysMsg.isPass,
                errMessage = sysMsg.MessageString
            };
            return Json(jsonResult);
        }
コード例 #13
0
 public CostingMasterDetailData(FieldCategory category)
 {
     this.Category = category;
     this.Params = new TableParams(category.CategoryName);
 }
コード例 #14
0
ファイル: CostIOController.cs プロジェクト: rivernli/SGP
        public JsonResult GenrateSubCategories()
        {
            string html = "";
            string errMessage = "";
            string dataId = Request["dataId"];
            string categoriesName = Request["categoryName"];
            string canEditCategory = Request["canEditCategory"];
            string headEditCategory = Request["headEditCategory"];

            int id = ParseHelper.Parse<int>(dataId);

            try
            {
                string[] cns = categoriesName.Split(',');
                foreach (string cn in cns)
                {
                    FieldCategory category = new FieldCategory(cn.Trim());
                    if (id > 0)
                    {
                        CostingInputDetail ciDetail = new CostingInputDetail();
                        ciDetail.FillSubCategoryData(category, id);
                    }
                    html += BI.SGP.BLL.UIManager.CostingMasterDataDetailHelper.GenrateSubCategory(category, cns.Length > 1, canEditCategory.IndexOf(cn) != -1, headEditCategory.IndexOf(cn) != -1);
                }
            }
            catch (Exception ex)
            {
                errMessage = ex.Message;
            }
            var result = new
            {
                success = (errMessage == "" ? true : false),
                html = html,
                errMessage = errMessage
            };
            return Json(result);
        }
コード例 #15
0
ファイル: DetailModelBase.cs プロジェクト: rivernli/SGP
        /// <summary>
        /// 
        /// </summary>
        /// <param name="category"></param>
        /// <param name="dataId"></param>
        /// <param name="number"></param>
        /// <param name="dicMasterData"></param>
        /// <param name="dicSubData"></param>
        private void FillCategoryData(FieldCategory category, int dataId, string number,
            Dictionary<string, DataTable> dicMasterData, Dictionary<string, DataTable> dicSubData)
        {
            DataTable dtData;
            foreach (FieldInfo fi in category.MasterFields)
            {
                string tableName = fi.TableName.ToUpper();
                if (dicMasterData.ContainsKey(tableName))
                {
                    dtData = dicMasterData[tableName];
                }
                else
                {
                    string tk = TableKey[tableName];
                    string strSql = "SELECT * FROM " + tableName + " WHERE " + tk + "=@DataId AND NVARCHAR1=@Number";

                    dtData = DbHelperSQL.Query(strSql,
                        new SqlParameter("@DataId", dataId),
                        new SqlParameter("@Number", number)).Tables[0];
                    dicMasterData.Add(tableName, dtData);
                }

                if (dtData.Rows.Count > 0 && dtData.Columns.Contains(fi.FieldName))
                {
                    fi.DataValue = dtData.Rows[0][fi.FieldName];
                }
            }

            foreach (FieldInfo fi in category.SubFields)
            {
                string entityName = fi.SubDataType.ToUpper();
                if (dicSubData.ContainsKey(entityName))
                {
                    dtData = dicSubData[entityName];
                }
                else
                {
                    if (entityName == "VVIPRODUCTINFORMATION")
                    {
                        string strSql = @"SELECT * FROM SGP_SubData WHERE EntityID in(select id from SGP_RFQForVVI where rfqid in(
                                            select RFQID from SGP_RFQForVVI where ID=" + dataId + @") ) ORDER BY DataIndex";
                        dtData = DbHelperSQL.Query(strSql).Tables[0];
                        dicSubData.Add(entityName, dtData);

                    }
                    else
                    {
                        string strSql = "SELECT * FROM SGP_SubData WHERE EntityID = " + dataId + " AND EntityName = '" + entityName + "' ORDER BY DataIndex";
                        dtData = DbHelperSQL.Query(strSql).Tables[0];
                        dicSubData.Add(entityName, dtData);
                    }

                }

                if (dtData.Rows.Count > 0 && dtData.Columns.Contains(fi.FieldName))
                {
                    ArrayList arr = new ArrayList();
                    foreach (DataRow dr in dtData.Rows)
                    {
                        arr.Add(dr[fi.FieldName]);
                    }
                    fi.DataValue = arr;
                }
            }
        }
コード例 #16
0
ファイル: DetailModelBase.cs プロジェクト: rivernli/SGP
        private void FillCategoryData(FieldCategory category, int dataId, Dictionary<string, DataTable> dicMasterData, Dictionary<string, DataTable> dicSubData)
        {
            DataTable dtData;
            foreach (FieldInfo fi in category.MasterFields)
            {
                string tableName = fi.TableName.ToUpper();
                if (dicMasterData.ContainsKey(tableName))
                {
                    dtData = dicMasterData[tableName];
                }
                else
                {
                    string tk = TableKey[tableName];
                    string strSql = "SELECT * FROM " + tableName + " WHERE " + tk + "=" + dataId;
                    dtData = DbHelperSQL.Query(strSql).Tables[0];
                    dicMasterData.Add(tableName, dtData);
                }

                if (dtData.Rows.Count > 0 && dtData.Columns.Contains(fi.FieldName))
                {
                    fi.DataValue = dtData.Rows[0][fi.FieldName];
                }
            }

            foreach (FieldInfo fi in category.SubFields)
            {
                string entityName = fi.SubDataType.ToUpper();
                if (dicSubData.ContainsKey(entityName))
                {
                    dtData = dicSubData[entityName];
                }
                else
                {
                    if (entityName == "VVIPRODUCTINFORMATION")
                    {
                        string strSql = @"SELECT * FROM SGP_SubData WHERE EntityID in(select id from SGP_RFQForVVI where rfqid in(
                                            select RFQID from SGP_RFQForVVI where ID=" + dataId + @") ) ORDER BY DataIndex";
                        dtData = DbHelperSQL.Query(strSql).Tables[0];
                        dicSubData.Add(entityName, dtData);

                    }
                    else if(entityName=="VVIDETAIL")
                    {

                        string strsqlforupdate = "update SGP_SubData set FLOAT16=b.UnitPrice1,FLOAT17=round((b.UnitPrice1-a.FLOAT12)/b.UnitPrice1*100,2)  from  SGP_SubData a,SGP_RFQPricing b where a.EntityID=b.RFQID and b.UnitPrice1>0 and a.EntityID = " + dataId + " AND a.EntityName = '" + entityName + "'";
                        DbHelperSQL.ExecuteSql(strsqlforupdate);
                        string strSql = "SELECT * FROM SGP_SubData WHERE EntityID = " + dataId + " AND EntityName = '" + entityName + "' ORDER BY DataIndex";
                        dtData = DbHelperSQL.Query(strSql).Tables[0];
                        dicSubData.Add(entityName, dtData);
                    }
                    else
                    {
                        string strSql = "SELECT * FROM SGP_SubData WHERE EntityID = " + dataId + " AND EntityName = '" + entityName + "' ORDER BY DataIndex";
                        dtData = DbHelperSQL.Query(strSql).Tables[0];
                        dicSubData.Add(entityName, dtData);
                    }

                }

                if (dtData.Rows.Count > 0 && dtData.Columns.Contains(fi.FieldName))
                {
                    ArrayList arr = new ArrayList();
                    foreach (DataRow dr in dtData.Rows)
                    {
                        arr.Add(dr[fi.FieldName]);
                    }
                    fi.DataValue = arr;
                }
            }
        }
コード例 #17
0
ファイル: ExcelHelper.cs プロジェクト: rivernli/SGP
        public static string ExportSCMasterTemplate(string tableKey)
        {
            FieldCategory fc = new FieldCategory(tableKey);
            IWorkbook workbook = new XSSFWorkbook();
            ISheet sheetDS = workbook.CreateSheet(tableKey);
            IRow rowColumn = sheetDS.CreateRow(0);
            //int index = 0;
            FieldInfoCollecton fields = fc.EnableFields;
            for (int i = 0; i < fields.Count; i++)
            {
                ICell cell = rowColumn.CreateCell(i);
                string colName = String.IsNullOrWhiteSpace(fields[i].DisplayName) ? fields[i].FieldName : fields[i].DisplayName;
                cell.SetCellValue(colName);
                ICellStyle cellStyle = workbook.CreateCellStyle();

                if (fields[i].Options.Required)
                {
                    cellStyle.FillForegroundColor = IndexedColors.Yellow.Index;
                }
                else
                {
                    cellStyle.FillForegroundColor = IndexedColors.Grey25Percent.Index;
                }
                cellStyle.FillPattern = FillPattern.SolidForeground;
                cell.CellStyle = cellStyle;
                sheetDS.AutoSizeColumn(i);

            }
            string tempFile = System.Web.HttpContext.Current.Server.MapPath("~/temp/") + Guid.NewGuid() + ".xlsx";
            using (var fileStream = FileHelper.CreateFile(tempFile))
            {
                workbook.Write(fileStream);
            }
            return tempFile;
        }
コード例 #18
0
ファイル: FieldCategory.cs プロジェクト: rivernli/SGP
        public static List<FieldCategory> GetMasterCategorys(params string[] categoryType)
        {
            string strWhere = "";
            foreach (string ct in categoryType)
            {
                if (strWhere != "")
                {
                    strWhere += " OR ";
                }

                strWhere += String.Format("CategoryType='{0}'", ct);
            }

            string strSql = string.Format("SELECT * FROM SYS_FieldCategory WHERE ParentID = 0 AND ({0}) ORDER BY Sort", strWhere);
            DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
            List<FieldCategory> list = new List<FieldCategory>();

            foreach (DataRow dr in dt.Rows)
            {
                FieldCategory fc = new FieldCategory();
                fc.FillCategory(dr);
                list.Add(fc);
            }

            return list;
        }
コード例 #19
0
ファイル: FieldCategory.cs プロジェクト: rivernli/SGP
 public static List<FieldCategory> GetChildCategories(FieldCategory category)
 {
     List<FieldCategory> childCategories = new List<FieldCategory>();
     string strSql = "SELECT * FROM SYS_FieldCategory WHERE ParentID = @ParentID ORDER BY Sort";
     DataTable dt = SqlText.ExecuteDataset(strSql, "@ParentID", category.ID).Tables[0];
     foreach (DataRow dr in dt.Rows)
     {
         FieldCategory fc = new FieldCategory();
         fc.FillCategory(dr);
         childCategories.Add(fc);
     }
     return childCategories;
 }
コード例 #20
0
ファイル: CostingPeriodDetail.cs プロジェクト: rivernli/SGP
 public CostingPeriodDetail(FieldCategory category)
     : base(category)
 {
 }
コード例 #21
0
ファイル: CostingPeriodDetail.cs プロジェクト: rivernli/SGP
 public CostingPeriodDetail(FieldCategory category, Dictionary<string, object> data)
     : base(category, data)
 {
 }
コード例 #22
0
        public JsonResult GenrateCategory()
        {
            string html = "";
            string errMessage = "";
            int id = 0;
            string dataId = Request["dataId"];
            string categoryName = Request["categoryName"];
            Int32.TryParse(dataId, out id);

            try
            {
                FieldCategory category = new FieldCategory(categoryName);
                if (id > 0)
                {
                    CostingMasterDetailData cmdd = new CostingMasterDetailData(category);
                    cmdd.FillCategoryData(id);
                }

                html = BI.SGP.BLL.UIManager.CostingMasterDataDetailHelper.GenrateCategory(category);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message;
            }
            var result = new
            {
                success = (errMessage == "" ? true : false),
                html = html,
                errMessage = errMessage
            };
            return Json(result);
        }
コード例 #23
0
 public ActionResult List()
 {
     FieldCategory fc = new FieldCategory("SCPeriod");
     ViewBag.Category = fc;
     return View();
 }
コード例 #24
0
        public JsonResult SaveOtherData()
        {
            SystemMessages sysMsg = new SystemMessages();
            int id = 0;
            string postData = Request["postData"];

            if (!String.IsNullOrWhiteSpace(postData))
            {
                System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                Dictionary<string, object> jsonData = jss.Deserialize<Dictionary<string, object>>(postData) as Dictionary<string, object>;

                string dataId = Convert.ToString(jsonData["dataId"]);
                Int32.TryParse(dataId, out id);
                FieldCategory category = new FieldCategory(Convert.ToString(jsonData["categoryName"]));
                Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>;

                using (TScope ts = new TScope())
                {
                    try
                    {
                        CostingOtherDetailData codd = new CostingOtherDetailData(category, data);
                        category.CheckDataType(data, sysMsg);
                        codd.CheckData(sysMsg);

                        if (sysMsg.isPass)
                        {
                            if (id > 0)
                            {
                                codd.Update(id);
                            }
                            else
                            {
                                id = codd.Add();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ts.Rollback();
                        sysMsg.isPass = false;
                        sysMsg.Messages.Add("Error", ex.Message);
                    }
                }
            }

            var jsonResult = new
            {
                DataId = id,
                success = sysMsg.isPass,
                errMessage = sysMsg.MessageString
            };
            return Json(jsonResult);
        }
コード例 #25
0
        private static string GenratePrintPage(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(@"<div><h3 align=""center"">" + fc.CategoryName + "</h3></div>");

            sb.Append(@"<table style=""width:98%"" id=""listTable"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""0"" bordercolor=""#000000"" >");
            FieldInfoCollecton enablefields = new FieldInfoCollecton();

            foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields)
            {
                if (fi.Enable == 1)
                {
                    enablefields.Add(fi);
                }
            }

            double RowCount = enablefields.Count;
            int colSize = 4;
            int colSpanTotal = 0;
            for (int i = 0; i < RowCount; i++)
            {
                if (colSpanTotal == 0)
                {
                    sb.Append(@"<tr style=""height:25px"">");
                }

                colSpanTotal++;

                int curSpan;
                if (enablefields[i].ColSpan == 0)
                {
                    curSpan = 1;
                }
                else if (enablefields[i].ColSpan > (colSize - 1))
                {
                    curSpan = colSize - 1;
                }
                else
                {
                    curSpan = enablefields[i].ColSpan;
                }
                colSpanTotal += curSpan;

                if (colSpanTotal <= colSize)
                {
                    sb.Append(UIManager.GeneratePrintField(enablefields[i]));
                }

                if (colSpanTotal == colSize)
                {
                    sb.Append("</tr>");
                    colSpanTotal = 0;
                }

                if (colSpanTotal > colSize)
                {
                    sb.Append("</tr>");
                    colSpanTotal = 0;
                    i--;
                }

            }
            sb.Append("</table>");

            return sb.ToString();
        }
コード例 #26
0
ファイル: SCMPriceMasterDetail.cs プロジェクト: rivernli/SGP
 private void TransColumnName(string categoryName, ref DataTable dtReport)
 {
     FieldCategory fc = new FieldCategory(categoryName);
     FieldInfoCollecton fields = fc.VisibleFields;
     foreach (FieldInfo field in fields)
     {
         if (dtReport.Columns.Contains(field.FieldName))
         {
             dtReport.Columns[field.FieldName].ColumnName = field.DisplayName;
         }
     }
 }
コード例 #27
0
ファイル: FPCUIManager.cs プロジェクト: rivernli/SGP
 private static string GenerateCategoryForPriceDetail(FieldCategory fc)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat(@"
     <div class='panel-heading' style='background:#f7f7f7;font-weight:bold;text-align:center'>
     {0}
         </div>", fc.CategoryName);
     sb.AppendFormat(@"
             <table class='table table-bordered table-striped' style='margin-bottom:0px;'>
             <thead class='thin-border-bottom'>
             <tr>
             <td>#</td>
             <td>Price Qty</td>
             <td>Unit Price</td>
             <td style='width:16%'>Price Type</td>
             <td style='width:7%'>MP%</td>
             <td style='width:7%'>OP%</td>
             <td style='width:40%'>Remarks</td>
             </tr></thead><tbody style='width:100%;'>"
         );
     for (int i = 1; i <= 5; i++)
     {
         sb.AppendFormat(@"<tr>
                         <td>{0}</td>
                         <td><input style=""width:100% !important; height:25px !important "" class='form-control' type='text' name='Price{0}Qty' id='Price{0}Qty' value='{1}' /></td>
                         <td><input style=""width:100% !important; height:25px !important ""  class='form-control NumberType1' type='text' name='UnitPrice{0}' id='UnitPrice{0}' value='{2}'/></td>
                         <td>{3}</td>
                         <td><input style=""width:100% !important; height:25px !important ""  class='form-control NumberType1' disabled=""disabled"" type='text' name='MP{0}' id='MP{0}' value='{5}' /></td>
                         <td><input style=""width:100% !important; height:25px !important ""  class='form-control NumberType1' disabled=""disabled"" type='text' name='OP{0}' id='OP{0}' value='{4}' /></td>
                        <td><input style=""width:100% !important; height:25px !important ""   type='text' name='Remark{0}' style='width:100%' id='Remark{0}' value='{6}'/></td>
                         </tr>", i
                               , fc.Fields[(i - 1) * 6 + 0].DataValue
                               , fc.Fields[(i - 1) * 6 + 1].DataValue
                               , GenerateDropdownList(fc.Fields[(i - 1) * 6 + 2])
                               , fc.Fields[(i - 1) * 6 + 3].DataValue
                               , fc.Fields[(i - 1) * 6 + 4].DataValue
                               , fc.Fields[(i - 1) * 6 + 5].DataValue
                               );
     }
     sb.Append("</tbody></table>");
     return sb.ToString();
 }
コード例 #28
0
ファイル: CostingOtherDetail.cs プロジェクト: rivernli/SGP
 public CostingOtherDetailData(FieldCategory category)
     : base(category)
 {
 }
コード例 #29
0
ファイル: FPCUIManager.cs プロジェクト: rivernli/SGP
        private static string GenrateCategory(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID, bool needHeader)
        {
            StringBuilder sb = new StringBuilder();

            FieldCategory priceDetailCategroy = allGategory.Find(t => t.ID == "7");
            FieldCategory termsConditionsCategory = allGategory.Find(t => t.ID == "8");
            FieldCategory VVItermsConditionsCategory = allGategory.Find(t => t.ID == "9");
            FieldCategory VVIpriceDetailCategroy = allGategory.Find(t => t.ID == "15");

            String GRole = fc.AllowedRoles;

            string[] GategoryRoles = GRole.Split(',');

            if (!GategoryRoles.Contains("ALL"))
            {
                AccessServiceReference.Role[] role = BI.SGP.BLL.Utils.AccessControl.CurrentLogonUser.Roles;
                List<string> CurrRole = new List<string>();
                if (role != null)
                {
                    foreach (AccessServiceReference.Role r in role)
                    {
                        CurrRole.Add(r.Name);
                    }
                }

                List<string> ExcepCurrRole = GategoryRoles.Except(CurrRole).ToList();
                if (ExcepCurrRole.Count > 0)
                {
                    return string.Empty;
                }
            }
            ID++;
            string fcactivity = fc.ActivityID;
            if (needHeader)
            {
                if (fcactivity != null)
                {
                    string[] curractivitys = fcactivity.Split(',');
                    if (curractivitys.Contains(ActivityID))
                    {
                        sb.Append(@"<div class=""panel panel-default"">
                           <div class=""panel-heading"">
                              <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle collapsed"">
                              <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i>
                              <i class=""icon-user bigger-130""></i>&nbsp; " + fc.CategoryName + @":</a>
                           </div>");
                        sb.Append(@"<div class=""panel-collapse collapse"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">");
                    }
                    else
                    {
                        sb.Append(@"<div class=""panel panel-default"">
                           <div class=""panel-heading"">
                              <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle"">
                              <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i>
                              <i class=""icon-user bigger-130""></i>&nbsp; " + fc.CategoryName + @":</a>
                           </div>");
                        sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">");
                    }
                }
                else
                {
                    sb.Append(@"<div class=""panel panel-default"">
                           <div class=""panel-heading"">
                              <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle"">
                              <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i>
                              <i class=""icon-user bigger-130""></i>&nbsp; " + fc.CategoryName + @":</a>
                           </div>");
                    sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">");
                }
            }

            sb.Append(@"<table>");
            {

                FieldInfoCollecton enablefields = new FieldInfoCollecton();

                foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields)
                {
                    if (fi.Enable == 1)
                    {

                        enablefields.Add(fi);
                    }

                }

                double RowCount = enablefields.Count;
                int colSize = 8;
                if (fc.CategoryName == "Closure Status")
                {
                    colSize = 6;
                    sb.Append("<thead style='width:100%'><tr><th style='width:15%'></th><th style='width:18.3333%'></th><th style='width:15%'></th><th style='width:18.3333%'></th><th style='width:15%'></th><th style='width:18.3333%'></th></tr></thead>");
                }
                else if (fc.ID == "5") //价格区域
                {
                    colSize = 6;
                    sb.Append("<thead style='width:100%'><tr><th style='width:20%'></th><th style='width:13%'></th><th style='width:20%'></th><th style='width:13%'></th><th style='width:20%'></th><th style='width:14%'></th></tr></thead>");
                }
                else if (fc.ID == "9")
                {
                    colSize = 10;
                    sb.Append("<thead style='width:100%'><tr><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th></tr></thead>");
                }
                else
                {

                    sb.Append("<thead style='width:100%'><tr><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th></tr></thead>");
                }

                sb.Append("<tbody  style='width:100%'>");

                int colSpanTotal = 0;

                for (int i = 0; i < RowCount; i++)
                {
                    if (colSpanTotal == 0)
                    {
                        sb.Append("<tr>");
                    }

                    colSpanTotal++;

                    int curSpan;
                    if (enablefields[i].ColSpan == 0)
                    {
                        curSpan = 1;
                    }
                    else if (enablefields[i].ColSpan > (colSize - 1))
                    {
                        curSpan = colSize - 1;
                    }
                    else
                    {
                        curSpan = enablefields[i].ColSpan;
                    }
                    colSpanTotal += curSpan;

                    if (colSpanTotal <= colSize)
                    {
                        sb.Append(GenerateField(enablefields[i]));
                    }

                    if (colSpanTotal == colSize)
                    {
                        sb.Append("</tr>");
                        colSpanTotal = 0;
                    }

                    if (colSpanTotal > colSize)
                    {
                        sb.Append("</tr>");
                        colSpanTotal = 0;
                        i--;
                    }
                }

                sb.Append("</tbody>");
                sb.Append("</table>");

                //价格区域
                if (fc.ID == "5")
                {
                    //绘制价格表格
                    //sb.AppendLine("<div style='padding:5px;'>");
                    sb.Append(GenerateCategoryForPriceDetail(priceDetailCategroy));
                    //sb.AppendLine("</div>");

                    //绘制Terms & Conditions头部
                    sb.AppendFormat(@"
            <div class='panel-heading' style='background:#f7f7f7;font-weight:bold;text-align:center'>
            {0}
            </div>"
                , termsConditionsCategory.CategoryName);

                    //绘制Terms & Conditions主体
                    string s = GenrateCategory(ref ID, allGategory, termsConditionsCategory, data, ActivityID, false);
                    sb.AppendLine(s);
                }

                if (fc.ID == "15")
                {
                    //绘制价格表格
                    //sb.AppendLine("<div style='padding:5px;'>");
                    sb.Append(GenerateCategoryForVerticalDetail(VVIpriceDetailCategroy));
                    //sb.AppendLine("</div>");

                }

                if (fc.ID == "4")
                {
                    //绘制Terms & Conditions头部
                    sb.AppendFormat(@"
            <div class='panel-heading' style='background:#f7f7f7;font-weight:bold;text-align:center'>
            {0}
            </div>", VVItermsConditionsCategory.CategoryName);
                    //绘制Terms & Conditions主体
                    string s = GenrateCategory(ref ID, allGategory, VVItermsConditionsCategory, data, ActivityID, false);
                    sb.AppendLine(s);
                }
            }
            if (needHeader)
            {
                sb.Append(@"</div></div></div>");
            }

            return sb.ToString();
        }
コード例 #30
0
ファイル: FieldCategory.cs プロジェクト: rivernli/SGP
        public static List<FieldCategory> GetAllCategorys()
        {
            string strSql = "SELECT * FROM SYS_FieldCategory ORDER BY Sort";
            DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
            List<FieldCategory> list = new List<FieldCategory>();

            foreach (DataRow dr in dt.Rows)
            {
                FieldCategory fc = new FieldCategory();
                fc.FillCategory(dr);
                list.Add(fc);
            }

            return list;
        }