Exemple #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (fup.HasFiles)
            {
                string upload_folder_path = "~/PatientDocument/" + Session["PatientId"];

                if (!Directory.Exists(upload_folder_path))
                {
                    Directory.CreateDirectory(Server.MapPath(upload_folder_path));
                }


                foreach (HttpPostedFile uploadedFile in fup.PostedFiles)
                {
                    string filename = uploadedFile.FileName;
                    string doa      = CommonConvert.DateFormat(ViewState["doa"].ToString());
                    //string filename = System.DateTime.Now.Millisecond.ToString() + "_" + uploadedFile.FileName;
                    string query = "insert into tblPatientDocument values('" + filename + "','" + System.DateTime.Now.ToString() + "','" + upload_folder_path + "/" + filename + "'," + Session["PatientId"].ToString() + ",'" + Request["DOA"].ToString() + "')";
                    db.executeQuery(query);

                    uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath(upload_folder_path), filename));
                    // listofuploadedfiles.Text += String.Format("{0}<br />", uploadedFile.FileName);
                }
            }
            getData();
        }
        catch (Exception ex)
        {
        }
    }
Exemple #2
0
 public Runner()
 {
     _connectinString = ConfigurationManager.AppSettings["ConnectionString"];
     _producer        = new ProducerBasic(RabbitMQManager.GetRabbitMQServer("rabbitMqCrlProperties"), "Product.AdsScore.Deleted");
     MAX_HOUR_LOOP    = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["MAX_HOUR_LOOP"]);
     HOUR_RUN         = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["HOUR_RUN"]);
 }
Exemple #3
0
        private void viewPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            long          RootId = CommonConvert.Obj2Int64(this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "ID").ToString());
            FrmProperties frm    = new FrmProperties(RootId);

            frm.Text      = this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, "Name").ToString();
            frm.MdiParent = this;
            frm.Show();
        }
Exemple #4
0
        public void ShouldConvertForNumberDotAndCommand()
        {
            var y = CommonConvert.ConvertStringToPrice("12.123.323,23");

            Assert.AreEqual(12123323, 23, y);

            var y1 = CommonConvert.ConvertStringToPrice("12,123,323.23");

            Assert.AreEqual(12123323, 23, y1);
        }
Exemple #5
0
        public bool RunQuery(string query, CommandType commandType, SqlParameter[] arPara, bool WaiRunOK = false, int TryRun = 0)
        {
            int iRun = 0;

            while (true)
            {
                try
                {
                    this.command.CommandType = commandType;
                    this.command.CommandText = query;
                    this.command.Parameters.Clear();
                    if (arPara != null)
                    {
                        this.command.Parameters.AddRange(arPara);
                    }
                    if (this.command.Connection.State == ConnectionState.Closed)
                    {
                        this.command.Connection.Open();
                    }
                    this.command.ExecuteNonQuery();
                    return(true);
                }
                catch (SqlException ex)
                {
                    if (ex.Number == -2)
                    {
                        log.Error(ex.Message);
                        iRun++;
                        if (WaiRunOK == false && iRun >= TryRun)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        log.Info(ex.Message + ex.StackTrace + query + CommonConvert.ArParaToString(arPara));
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    if (!WaiRunOK)
                    {
                        log.ErrorFormat("Exception sql run" + ex.Message + ex.StackTrace + command.CommandText);
                        return(false);
                    }
                    else
                    {
                        Thread.Sleep(10000);
                    }
                }
            }
        }
Exemple #6
0
        private string DownloadHtml(JobCrlProperties jobDownloadHtml)
        {
            WebExceptionStatus w = WebExceptionStatus.ConnectFailure;
            var html             = this._downloadHtml.GetHtml(jobDownloadHtml.DetailUrl, 45, 2, out w);

            html = CommonConvert.RemoveScripTag(html);
            html = CommonConvert.RemoveCommentXML(html);



            return(html);
        }
Exemple #7
0
        public void ProcessAllIdProductByCompany(string domain, EventHandler <long> eventHandler)
        {
            string query = string.Format("select id from product_properties.html_id where domain = '{0}';", domain);

            foreach (var VARIABLE in _session.Execute(query, 1000))
            {
                long productIds = CommonConvert.Obj2Int64(VARIABLE.GetValue(typeof(long), "id"));
                if (productIds > 0)
                {
                    eventHandler(this, productIds);
                }
            }
        }
Exemple #8
0
 protected override void OnStart(string[] args)
 {
     _workerCount = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["WorkerCount"]);
     for (var i = 0; i < _workerCount; i++)
     {
         var workerTask = new Task(() =>
         {
             WorkerLog wk = new WorkerLog();
             wk.StartConsume();
             Console.ReadLine();
         });
         workerTask.Start();
     }
 }
Exemple #9
0
        public T ConvertByteArrayToObject <T, TK, TP>(byte[] bytes, TK obj, TP parentObj)
        {
            //获取数据包总大小
            DataSize = parentObj.ExtGetPropertyValueByName <TP, short>(_innerPropertyName0) * _singleDataSize;
            if (!string.IsNullOrEmpty(_innerPropertyName1))
            {
                DataSize += parentObj.ExtGetPropertyValueByName <TP, short>(_innerPropertyName1) * _singleDataSize;
            }

            //截取需要的字节数组
            var allBytes = new byte[DataSize];

            Array.Copy(bytes, 0, allBytes, 0, DataSize);

            //获取集合里面的参数类型(默认都只有一种参数类型)
            var type     = obj.GetType();
            var argument = type.GetGenericArguments()[0];

            //获取单个数据包的总个数
            var numPackages = DataSize / _singleDataSize;

            for (int i = 0; i < numPackages; i++)
            {
                //创建集合里面的对应参数类型实例
                var instance = argument.ExtCreateInstance <object>();
                if (instance != null)
                {
                    var startLocation = i * _singleDataSize;

                    var bodys = new List <Tuple <PropertyInfo, IBodyDataPackageAttribute, object> >();
                    //读取当前类包含的所有特性集合
                    CommonConvert.ReadChildProperty(instance.GetType().GetProperties(), instance, ref bodys);
                    //排序
                    var sl = bodys.OrderBy(s => s.Item2.SortLocation);
                    //对每个属性赋值
                    foreach (var packageAttribute in sl)
                    {
                        var newBytes = new byte[packageAttribute.Item2.DataSize];
                        Array.Copy(allBytes, startLocation, newBytes, 0, newBytes.Length);
                        startLocation += packageAttribute.Item2.DataSize;
                        packageAttribute.Item1.SetValue(instance, packageAttribute.Item2.ConvertByteArrayToObject <object, PropertyInfo>(newBytes, packageAttribute.Item1), null);
                        //instance.ExtSetPropertyValue(packageAttribute.Item2.ConvertByteArrayToObject<object, PropertyInfo>(newBytes, packageAttribute.Item1), packageAttribute.Item1);
                    }
                    //像集合中添加一条数据
                    type.InvokeMember("Add", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, obj, new[] { instance });
                }
            }
            return((T)(object)obj);
        }
Exemple #10
0
        public void repositoryItemSearchLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            long PropertyID       = CommonConvert.Obj2Int64((this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as DataRowView)["ID"]);
            var  searchLookUpEdit = sender as SearchLookUpEdit;

            if (searchLookUpEdit == null)
            {
                return;
            }

            DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit riSearchLookUpEdit = searchLookUpEdit.Properties as DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit;
            var  rowByKeyValue  = riSearchLookUpEdit.View.GetFocusedRowCellValue("ID");
            long PropertyRootID = CommonConvert.Obj2Int64(rowByKeyValue);

            this.propertiesMerchantTableAdapter.Connection.ConnectionString = ConfigurationManager.AppSettings["MerchantProperties"];
            this.propertiesMerchantTableAdapter.Update_RootProperty(PropertyRootID, PropertyID);
        }
Exemple #11
0
 public void FattanToSql(PropertyProduct propertyData)
 {
     foreach (var VARIABLE in propertyData.Properties)
     {
         string propertyName = propertyData.Category + ":" + VARIABLE.Key;
         long   propertyID   = CommonConvert.CrcProductID(propertyName);
         bool   bOk          = this.sqlDbProperties.RunQuery("sp_Property_Ins", CommandType.StoredProcedure, new[]
         {
             SqlDb.CreateParamteterSQL("CategoryID", propertyData.CategoryId, SqlDbType.BigInt),
             SqlDb.CreateParamteterSQL("CategoryName", propertyData.Category, SqlDbType.NVarChar),
             SqlDb.CreateParamteterSQL("ProperyID", propertyID, SqlDbType.BigInt),
             SqlDb.CreateParamteterSQL("ProperyValue", VARIABLE.Value, SqlDbType.NVarChar),
             SqlDb.CreateParamteterSQL("CompanyID", propertyData.CompanyID, SqlDbType.BigInt),
             SqlDb.CreateParamteterSQL("ProductID", propertyData.ProductId, SqlDbType.BigInt),
             SqlDb.CreateParamteterSQL("PropertyName", propertyName, SqlDbType.NVarChar),
         });
     }
 }
Exemple #12
0
        public Entity.ConfigProperty GetConfig(string domain)
        {
            DataTable tbl = this._sqlDbProduct.GetTblData(@"
      SELECT TOP 1 c.[Id]
      ,c.[CompanyId]
      ,c.[TypeLayout]
      ,c.[XPath]
      ,c.[JSonOtherConfig]
      ,c.[JSonOtherConfigDemo]
	  ,c.UrlTest
	  , cf.CategoryXPath
      , co.Domain
      , cf.RemoveLastItemClassification
      , cf.TimeDelay
  FROM [dbo].[Configuration_Property] c
  INNER JOIN Configuration cf ON cf.CompanyID = c.CompanyId
  INNER JOIN Company co ON co.Id = cf.CompanyId
  Where co.Domain = @CompanyId"
                                                          , CommandType.Text, new SqlParameter[]
            {
                SqlDb.CreateParamteterSQL("@CompanyId", domain, SqlDbType.NVarChar)
            });

            if (tbl.Rows.Count > 0)
            {
                var row = tbl.Rows[0];
                return(new ConfigProperty()
                {
                    CategoryXPath = CommonConvert.Obj2String(row["CategoryXPath"]),
                    CompanyId = CommonConvert.Obj2Int64(row["CompanyId"]),
                    JSonOtherConfig = CommonConvert.Obj2String(row["JSonOtherConfig"]),
                    TypeLayout = CommonConvert.Obj2Int(row["TypeLayout"]),
                    XPath = CommonConvert.Obj2String(row["XPath"]),
                    UrlTest = CommonConvert.Obj2String(row["UrlTest"]),
                    Domain = CommonConvert.Obj2String(row["Domain"]),
                    RemoveLastItemClassification = CommonConvert.Obj2Bool(row["RemoveLastItemClassification"]),
                    TimeDelay = CommonConvert.Obj2Int(row["TimeDelay"])
                });
            }
            else
            {
                return(null);
            }
        }
Exemple #13
0
        public async void UpdateCategoryId()
        {
            var filter = new BsonDocument();
            var count  = 0;

            using (var cursor = await _colPropertiesData.FindAsync(filter))
            {
                while (await cursor.MoveNextAsync())
                {
                    var batch = cursor.Current;
                    foreach (var document in batch)
                    {
                        var propertyData = BsonSerializer.Deserialize <PropertyProduct>(document);
                        if (propertyData != null)
                        {
                            if (propertyData.ProductId == 0)
                            {
                                this._colPropertiesData.DeleteOne(document);
                                this._log.Info(string.Format("Delete item"));
                            }
                            else
                            {
                                propertyData.CategoryId = CommonConvert.CrcProductID(propertyData.Category);
                                var update = Builders <BsonDocument> .Update
                                             .Set("category_id", propertyData.CategoryId)
                                             .CurrentDate("lastModified");

                                this._colPropertiesData.UpdateOne(document, update);
                                _log.Info(string.Format("Updated for item {0} {1}", propertyData._id, propertyData.ProductId));
                            }
                        }
                        else
                        {
                            _log.Info("ProductData null");
                        }

                        _log.Info(string.Format("Process {0} items ", count));
                        count++;
                    }
                }
            }
        }
Exemple #14
0
 public void ConvertObjectToByteArray <T>(T obj)
 {
     if (obj is ICollection)
     {
         var collection = obj as ICollection;
         var dataAll    = new byte[0];
         foreach (var coll in collection)
         {
             //获取当前实体类转换成的字节数组
             var data = CommonConvert.GetObjData(coll);
             //创建新的数组进行合并并赋值给变量保存
             var bytes = new byte[data.Length + dataAll.Length];
             dataAll.CopyTo(bytes, 0);
             data.CopyTo(bytes, dataAll.Length);
             dataAll = bytes;
         }
         DataSize     = dataAll.Length;
         _dataPackage = dataAll;
     }
 }
Exemple #15
0
        public void MapData(string domain)
        {
            this.database  = RedisManager.GetRedisServer("redisPropertiesProduct").GetDatabase(1);
            this._cacheMan = CacheManager.GetCacheServer("redisPropertiesProduct");

            int    i             = 0;
            string PropertyName  = "";
            string PropertyValue = "";
            long   PropertyID    = 0;
            long   companyID     = LibExtra.CommonConvert.Obj2Int64(this.sqldb.GetTblData(string.Format("Select ID from Company where Domain = '{0}'", domain)).Rows[0]["ID"]);

            this.sqldb.ProcessDataTableLarge(string.Format("select ID,ClassificationID from product where company = {0} order by ID", companyID), 1000, (obj, iRow) =>
            {
                long ProductID        = CommonConvert.Obj2Int64(obj["ID"]);
                long ClassificationID = CommonConvert.Obj2Int64(obj["ClassificationID"]);

                string ClassificationName = this.sqldb.GetTblData(string.Format("Select Name from Classification where ID = {0}", ClassificationID)).Rows[0]["Name"].ToString();

                var lstProperties = _cacheMan.Get <List <KeyValuePair <string, string> > >("prs:" + ProductID, true);
                if (lstProperties != null && lstProperties.Count > 0)
                {
                    foreach (var item in lstProperties)
                    {
                        PropertyName  = ClassificationName + ":" + item.Key.ToString();
                        PropertyValue = item.Value.ToString();
                        PropertyID    = CommonConvert.CrcProductID(PropertyName);
                    }
                    string querytest = string.Format("Insert into PropertyItem (PropertyID, ProductID, Value) values ({0},{1},N'{2}')", PropertyID, ProductID, PropertyValue);
                    sqldbProperties.RunQuery(string.Format("Insert into Category (ID, Name, CompanyID) values ({0},N'{1}',{2})", ClassificationID, ClassificationName, companyID), CommandType.Text, new System.Data.SqlClient.SqlParameter[] { });
                    sqldbProperties.RunQuery(string.Format("Insert into Properties (ID,CategoryID, Name, CompanyID) values ({0},{1},N'{2}',{3})", PropertyID, ClassificationID, PropertyName, companyID), CommandType.Text, new System.Data.SqlClient.SqlParameter[] { });
                    sqldbProperties.RunQuery(string.Format("Insert into Product_PropertyCategory (ID, CompanyId, Name,Property_Id,CategoryID) values ({0},{1},N'{2}',{3},{4})", ProductID, companyID, PropertyName, PropertyID, ClassificationID), CommandType.Text, new System.Data.SqlClient.SqlParameter[] { });
                    sqldbProperties.RunQuery(querytest, CommandType.Text, new System.Data.SqlClient.SqlParameter[] { });
                }
                i++;
                log.InfoFormat("{0} {1}", i, ProductID);
                return(true);
            });
        }
Exemple #16
0
        public PropertyProduct ParseData(HtmlDocument document)
        {
            PropertyProduct propertyData = new PropertyProduct();

            propertyData.Category   = "";
            propertyData.Domain     = _configPropertyNomal.Domain;
            propertyData.CategoryId = CommonConvert.CrcProductID(propertyData.Category);
            var     nodeRows        = document.DocumentNode.SelectNodes(_configPropertyNomal.XPath);
            dynamic configOtherData = JObject.Parse(_configPropertyNomal.JSonOtherConfig);
            string  colH            = configOtherData.IndexColHeader.ToString();
            string  colB            = configOtherData.IndexColData.ToString();

            if (nodeRows != null)
            {
                foreach (var variable in nodeRows)
                {
                    var nodeCell = variable.SelectNodes("./td");
                    if (nodeCell != null)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(nodeCell[Convert.ToInt32(colH)].InnerText.Trim()) && !string.IsNullOrEmpty(nodeCell[Convert.ToInt32(colB)].InnerText.Trim()))
                            {
                                propertyData.Properties.Add(
                                    nodeCell[Convert.ToInt32(colH)].InnerText.Trim(),
                                    nodeCell[Convert.ToInt32(colB)].InnerText.Trim());
                            }
                        }
                        catch (Exception ex)
                        {
                            // ignored
                        }
                    }
                }
            }
            return(propertyData);
        }
Exemple #17
0
        public void ProcessProduct(string domain, EventHandler <Product> eventHandler)
        {
            long companyID = CommonConvert.Obj2Int64(this._sqlDb.GetTblData((string.Format("select ID from Company where Domain = '{0}'", domain))).Rows[0]["ID"]);

            this._sqlDb.ProcessDataTableLarge(string.Format(@"
select 
--top 1000  
pt.ID, pt.DetailUrl
from  Product pt
where pt.Company = {0}
order by pt.ID
", companyID),
                                              1000, (obj, iRow) =>
            {
                eventHandler(this, new Product()
                {
                    Id               = Convert.ToInt64(obj["ID"]),
                    DetailUrl        = Convert.ToString(obj["DetailUrl"]),
                    ClassificationId = 0, // CommonConvert.Obj2Int64(obj["ClassificationID"]),
                    Classification   = "" //Convert.Obj2String(obj["Classification"])
                });
                return(true);
            });
        }
Exemple #18
0
        private DataGridColumn GetDataGridColumn(GridItem gItem)
        {
            Binding bding = new Binding();

            if (!string.IsNullOrEmpty(gItem.PropertyName))
            {
                bding.Mode = BindingMode.TwoWay;
                bding.Path = new PropertyPath(gItem.PropertyName);
                if (gItem.ReferenceDataInfo != null)
                {
                    IValueConverter converter = CommonFunction.GetIValueConverter(gItem.ReferenceDataInfo.Type);
                    bding.Converter = converter;
                }
                else if (gItem.PropertyName.Contains("MONEY"))
                {
                    IValueConverter converter = new CurrencyConverter();
                    bding.Converter = converter;
                }
                else
                {
                    IValueConverter converter = new CommonConvert(gItem);
                    bding.Converter = converter;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("");
            }

            DataGridColumn dgc = null;

            switch (gItem.CType)
            {
            case ControlType.CheckBox:
                DataGridCheckBoxColumn dgcc = new DataGridCheckBoxColumn();
                dgcc.IsThreeState = false;
                dgcc.Binding      = bding;
                dgc = dgcc;
                break;

            case ControlType.Label:
                if (gItem.ReferenceDataInfo != null)
                {
                    DataGridReferenceColumn dgrc = new DataGridReferenceColumn();
                    dgrc.Binding           = bding;
                    dgrc.DisplayMemberPath = "Text";

                    dgc = dgrc;
                }
                else
                {
                    DataGridTextColumn dgtc = new MyDataGridTextColumn(gItem);
                    dgtc.Binding = bding;
                    dgc          = dgtc;
                }
                break;

            case ControlType.Combobox:

                DataGridComboBoxColumn dgcbc = new DataGridComboBoxColumn();
                if (gItem.ReferenceDataInfo != null)
                {
                    IList <ITextValueItem> list = DataCore.GetRefData(gItem.ReferenceDataInfo.Type);
                    dgcbc.ItemsSource = list;
                }
                dgcbc.DisplayMemberPath = "Text";
                dgcbc.Binding           = bding;

                dgc = dgcbc;
                break;

            case ControlType.TreeViewItem:
                DataGridIconColumn dgtvic = new DataGridIconColumn();
                dgtvic.Binding = bding;
                dgc            = dgtvic;
                break;

            case ControlType.Templete:

                //"<StackPanel Orientation="Horizontal"><smtx:ImageButton x:Name="myDelete" Click="Delete_Click"/></StackPanel>"
                var gridXCs = new XElementString("StackPanel", new XAttributeString("Orientation", "Horizontal"));

                DataGridTemplateColumn dtc = new DataGridTemplateColumn();
                dtc.CellTemplate = DataTemplateHelper.GetDataTemplate(gridXCs);
                dgc = dtc;
                break;
            }

            return(dgc);
        }
Exemple #19
0
    private void bindData()
    {
        DBHelperClass db    = new DBHelperClass();
        string        query = "";

        query = "select top 1 * from tblPatientIEDetailPage2 where PatientIE_ID=" + Session["PatientIE_ID"].ToString();
        DataSet ds = db.selectData(query);

        if (ds.Tables[0].Rows.Count > 0)
        {
            //chk_seizures.Checked = ds.Tables[0].Rows[0]["Seizures"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Seizures"].ToString()) : false;
            //chk_chest_pain.Checked = ds.Tables[0].Rows[0]["ChestPain"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["ChestPain"].ToString()) : false;
            //chk_shortness_of_breath.Checked = ds.Tables[0].Rows[0]["ShortnessOfBreath"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["ShortnessOfBreath"].ToString()) : false;
            //chk_jaw_pain.Checked = ds.Tables[0].Rows[0]["Jawpain"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Jawpain"].ToString()) : false;
            //chk_abdominal_pain.Checked = ds.Tables[0].Rows[0]["AbdominalPain"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["AbdominalPain"].ToString()) : false;
            //chk_fever.Checked = ds.Tables[0].Rows[0]["Fevers"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Fevers"].ToString()) : false;
            //chk_diarrhea.Checked = ds.Tables[0].Rows[0]["Diarrhea"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Diarrhea"].ToString()) : false;
            //chk_bowel_bladder.Checked = ds.Tables[0].Rows[0]["Bowel"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Bowel"].ToString()) : false;
            //chk_blurred.Checked = ds.Tables[0].Rows[0]["DoubleVision"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["DoubleVision"].ToString()) : false;
            //chk_recent_wt.Checked = ds.Tables[0].Rows[0]["RecentWeightloss"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["RecentWeightloss"].ToString()) : false;
            //chk_episodic_ligth.Checked = ds.Tables[0].Rows[0]["Episodic"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Episodic"].ToString()) : false;
            //chk_rashes.Checked = ds.Tables[0].Rows[0]["Rashes"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Rashes"].ToString()) : false;
            //chk_hearing_loss.Checked = ds.Tables[0].Rows[0]["HearingLoss"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["HearingLoss"].ToString()) : false;
            //chk_sleep_disturbance.Checked = ds.Tables[0].Rows[0]["NightSweats"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["NightSweats"].ToString()) : false;
            //chk_depression.Checked = ds.Tables[0].Rows[0]["Depression"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Depression"].ToString()) : false;

            //chk_bloodinurine.Checked = ds.Tables[0].Rows[0]["dloodinurine"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["dloodinurine"].ToString()) : false;

            LTricepstxt.Text      = Convert.ToString(ds.Tables[0].Rows[0]["DTRtricepsLeft"]);
            RTricepstxt.Text      = Convert.ToString(ds.Tables[0].Rows[0]["DTRtricepsRight"]);
            LBicepstxt.Text       = Convert.ToString(ds.Tables[0].Rows[0]["DTRBicepsLeft"]);
            RBicepstxt.Text       = Convert.ToString(ds.Tables[0].Rows[0]["DTRBicepsRight"]);
            RBrachioradialis.Text = Convert.ToString(ds.Tables[0].Rows[0]["DTRBrachioRight"]);
            LBrachioradialis.Text = Convert.ToString(ds.Tables[0].Rows[0]["DTRBrachioLeft"]);
            LKnee.Text            = Convert.ToString(ds.Tables[0].Rows[0]["DTRKneeLeft"]);
            RKnee.Text            = Convert.ToString(ds.Tables[0].Rows[0]["DTRKneeRight"]);
            LAnkle.Text           = Convert.ToString(ds.Tables[0].Rows[0]["DTRAnkleLeft"]);
            RAnkle.Text           = Convert.ToString(ds.Tables[0].Rows[0]["DTRAnkleRight"]);
            UExchk.Checked        = ds.Tables[0].Rows[0]["UEdtr"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["UEdtr"].ToString()) : false;
            chkPinPrick.Checked   = ds.Tables[0].Rows[0]["Pinprick"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Pinprick"].ToString()) : false;
            chkLighttouch.Checked = ds.Tables[0].Rows[0]["Lighttouch"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Lighttouch"].ToString()) : false;
            txtSensory.Text       = Convert.ToString(ds.Tables[0].Rows[0]["Sensory"]);
            LESen_Click.Checked   = ds.Tables[0].Rows[0]["LEsen"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["LEsen"].ToString()) : false;
            TextBox4.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL3Right"]);
            txtDMTL3.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL3Left"]);
            TextBox6.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL4Right"]);
            TextBox5.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL4Left"]);
            TextBox8.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL5Right"]);
            TextBox7.Text         = Convert.ToString(ds.Tables[0].Rows[0]["LEL5Left"]);
            TextBox10.Text        = Convert.ToString(ds.Tables[0].Rows[0]["LES1Left"]);
            TextBox21.Text        = Convert.ToString(ds.Tables[0].Rows[0]["LES1Right"]);
            TextBox25.Text        = Convert.ToString(ds.Tables[0].Rows[0]["LELumberParaspinalsRight"]);
            TextBox24.Text        = Convert.ToString(ds.Tables[0].Rows[0]["LELumberParaspinalsLeft"]);
            UESen_Click.Checked   = ds.Tables[0].Rows[0]["UEsen"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["UEsen"].ToString()) : false;
            TextBox9.Text         = Convert.ToString(ds.Tables[0].Rows[0]["UEC5Left"]);
            txtUEC5Right.Text     = Convert.ToString(ds.Tables[0].Rows[0]["UEC5Right"]);
            TextBox11.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC6Left"]);
            TextBox12.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC6Right"]);
            TextBox13.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC7Left"]);
            TextBox14.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC7Right"]);
            TextBox15.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC8Left"]);
            TextBox16.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UEC8Right"]);
            TextBox18.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UET1Right"]);
            TextBox17.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UET1Left"]);
            TextBox20.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UECervicalParaspinalsRight"]);
            TextBox19.Text        = Convert.ToString(ds.Tables[0].Rows[0]["UECervicalParaspinalsLeft"]);
            //  cboHoffmanexam.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["HoffmanExam"]);
            // chkStocking.Checked = ds.Tables[0].Rows[0]["Stocking"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Stocking"].ToString()) : false;
            //chkGlove.Checked = ds.Tables[0].Rows[0]["Glove"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["Glove"].ToString()) : false;
            LEmmst.Checked       = ds.Tables[0].Rows[0]["LEmmst"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["LEmmst"].ToString()) : false;
            TextBox23.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEHipFlexionRight"]);
            TextBox22.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEHipFlexionLeft"]);
            TextBox41.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEHipAbductionRight"]);
            TextBox40.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEHipAbductionLeft"]);
            TextBox27.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEKneeExtensionRight"]);
            TextBox26.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEKneeExtensionLeft"]);
            TextBox43.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEKneeFlexionRight"]);
            TextBox42.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEKneeFlexionLeft"]);
            TextBox29.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnkleDorsiRight"]);
            TextBox28.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnkleDorsiLeft"]);
            TextBox45.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnklePlantarRight"]);
            TextBox44.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnklePlantarLeft"]);
            TextBox47.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnkleExtensorRight"]);
            TextBox46.Text       = Convert.ToString(ds.Tables[0].Rows[0]["LEAnkleExtensorLeft"]);
            UEmmst.Checked       = ds.Tables[0].Rows[0]["UEmmst"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["UEmmst"].ToString()) : false;
            TextBox31.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEShoulderAbductionRight"]);
            TextBox30.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEShoulderAbductionLeft"]);
            TextBox49.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEShoulderFlexionRight"]);
            TextBox48.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEShoulderFlexionLeft"]);
            TextBox33.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowExtensionRight"]);
            TextBox32.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowExtensionLeft"]);
            TextBox51.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowFlexionRight"]);
            TextBox50.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowFlexionLeft"]);
            TextBox53.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowSupinationRight"]);
            TextBox52.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowSupinationLeft"]);
            TextBox55.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowPronationRight"]);
            TextBox54.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEElbowPronationLeft"]);
            TextBox37.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEWristFlexionRight"]);
            TextBox36.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEWristFlexionLeft"]);
            TextBox57.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEWristExtensionRight"]);
            TextBox56.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEWristExtensionLeft"]);
            TextBox39.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEHandGripStrengthRight"]);
            TextBox38.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEHandGripStrengthLeft"]);
            TextBox59.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEHandFingerAbductorsRight"]);
            TextBox58.Text       = Convert.ToString(ds.Tables[0].Rows[0]["UEHandFingerAbductorsLeft"]);
            txtIntactExcept.Text = Convert.ToString(ds.Tables[0].Rows[0]["intactexcept"]);
            LEdtr.Checked        = ds.Tables[0].Rows[0]["LEdtr"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["LEdtr"].ToString()) : false;
        }
        else
        {
            PopulateUIDefaults();
        }

        query = "select * from tblPage3HTMLContent where  PatientIE_ID=" + Session["PatientIE_ID"].ToString();
        ds    = db.selectData(query);

        if (ds.Tables[0].Rows.Count > 0)
        {
            divHtml.InnerHtml    = ds.Tables[0].Rows[0]["HTMLContent"].ToString();
            divtopHtml.InnerHtml = ds.Tables[0].Rows[0]["topSectionHTML"].ToString();
        }
        else
        {
            bindHtml();
        }

        query = "Select * from tblPatientIEDetailPage3 WHERE PatientIE_ID = " + Session["PatientIE_ID"].ToString();
        ds    = db.selectData(query);


        if (ds.Tables[0].Rows.Count > 0)
        {
            cboGAIT.Text                  = ds.Tables[0].Rows[0]["GAIT"].ToString().Trim();
            cboAmbulates.Text             = ds.Tables[0].Rows[0]["Ambulates"].ToString().Trim();
            chkFootslap.Checked           = CommonConvert.ToBoolean(ds.Tables[0].Rows[0]["Footslap"].ToString());
            chkKneehyperextension.Checked = CommonConvert.ToBoolean(ds.Tables[0].Rows[0]["Kneehyperextension"].ToString());
            chkUnabletohealwalk.Checked   = CommonConvert.ToBoolean(ds.Tables[0].Rows[0]["Unabletohealwalk"].ToString());
            chkUnabletotoewalk.Checked    = CommonConvert.ToBoolean(ds.Tables[0].Rows[0]["Unabletotoewalk"].ToString());
            txtOther.Text                 = ds.Tables[0].Rows[0]["Other"].ToString().Trim();
        }
    }
Exemple #20
0
    public void PopulateUIDefaults()
    {
        XmlDocument xmlDoc = new XmlDocument();
        string      filename;

        //filename = "~/Template/Default_" + Session["uname"].ToString() + ".xml";
        //if (File.Exists(Server.MapPath(filename)))
        //{ xmlDoc.Load(Server.MapPath(filename)); }
        //else { xmlDoc.Load(Server.MapPath("~/Template/Default_Admin.xml")); }
        xmlDoc.Load(Server.MapPath("~/Template/Default_Admin.xml"));

        XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/Defaults/IEPage3");

        foreach (XmlNode node in nodeList)
        {
            if (cboGAIT.Text == "")
            {
                cboGAIT.Text = node.SelectSingleNode("GAIT") == null?cboGAIT.Text.ToString().Trim() : node.SelectSingleNode("GAIT").InnerText;
            }
            if (cboAmbulates.Text == "")
            {
                cboAmbulates.Text = node.SelectSingleNode("Ambulates") == null?cboAmbulates.Text.ToString().Trim() : node.SelectSingleNode("Ambulates").InnerText;
            }
            chkFootslap.Checked           = node.SelectSingleNode("Footslap") == null ? chkFootslap.Checked : CommonConvert.ToBoolean(node.SelectSingleNode("Footslap").InnerText);
            chkKneehyperextension.Checked = node.SelectSingleNode("Kneehyperextension") == null ? chkKneehyperextension.Checked : CommonConvert.ToBoolean(node.SelectSingleNode("Kneehyperextension").InnerText);
            chkUnabletohealwalk.Checked   = node.SelectSingleNode("Unabletohealwalk") == null ? chkUnabletohealwalk.Checked : CommonConvert.ToBoolean(node.SelectSingleNode("Unabletohealwalk").InnerText);
            chkUnabletotoewalk.Checked    = node.SelectSingleNode("Unabletotoewalk") == null ? chkUnabletotoewalk.Checked : CommonConvert.ToBoolean(node.SelectSingleNode("Unabletotoewalk").InnerText);
            if (txtOther.Text == "")
            {
                txtOther.Text = node.SelectSingleNode("Other") == null?txtOther.Text.ToString().Trim() : node.SelectSingleNode("Other").InnerText;
            }
        }

        xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("~/Template/Default_Admin.xml"));
        nodeList = xmlDoc.DocumentElement.SelectNodes("/Defaults/IEPage2");

        foreach (XmlNode node in nodeList)
        {
            txtIntactExcept.Text = node.SelectSingleNode("intactexcept").InnerText;
            LEdtr.Checked        = node.SelectSingleNode("LEdtr") == null ? LEdtr.Checked : Convert.ToBoolean(node.SelectSingleNode("LEdtr").InnerText);

            //  chk_depression.Checked = node.SelectSingleNode("Depression") == null ? chk_depression.Checked : Convert.ToBoolean(node.SelectSingleNode("Depression").InnerText);

            LTricepstxt.Text      = node.SelectSingleNode("DTRtricepsLeft").InnerText;
            RTricepstxt.Text      = node.SelectSingleNode("DTRtricepsRight").InnerText;
            LBicepstxt.Text       = node.SelectSingleNode("DTRBicepsLeft").InnerText;
            RBicepstxt.Text       = node.SelectSingleNode("DTRBicepsRight").InnerText;
            RBrachioradialis.Text = node.SelectSingleNode("DTRBrachioRight").InnerText;
            LBrachioradialis.Text = node.SelectSingleNode("DTRBrachioLeft").InnerText;
            LKnee.Text            = node.SelectSingleNode("DTRKneeLeft").InnerText;
            RKnee.Text            = node.SelectSingleNode("DTRKneeRight").InnerText;
            LAnkle.Text           = node.SelectSingleNode("DTRAnkleLeft").InnerText;
            RAnkle.Text           = node.SelectSingleNode("DTRAnkleRight").InnerText;

            UExchk.Checked = node.SelectSingleNode("UEdtr") == null ? UExchk.Checked : Convert.ToBoolean(node.SelectSingleNode("UEdtr").InnerText);

            chkPinPrick.Checked   = node.SelectSingleNode("Pinprick") == null ? chkPinPrick.Checked : Convert.ToBoolean(node.SelectSingleNode("Pinprick").InnerText);
            chkLighttouch.Checked = node.SelectSingleNode("Lighttouch") == null ? chkPinPrick.Checked : Convert.ToBoolean(node.SelectSingleNode("Lighttouch").InnerText);
            txtSensory.Text       = node.SelectSingleNode("Sensory").InnerText;
            LESen_Click.Checked   = node.SelectSingleNode("LEsen") == null ? chkPinPrick.Checked : Convert.ToBoolean(node.SelectSingleNode("LEsen").InnerText);
            TextBox4.Text         = node.SelectSingleNode("LEL3Right").InnerText;
            txtDMTL3.Text         = node.SelectSingleNode("LEL3Left").InnerText;
            TextBox6.Text         = node.SelectSingleNode("LEL4Right").InnerText;
            TextBox5.Text         = node.SelectSingleNode("LEL4Left").InnerText;
            TextBox8.Text         = node.SelectSingleNode("LEL5Right").InnerText;
            TextBox7.Text         = node.SelectSingleNode("LEL5Left").InnerText;
            TextBox10.Text        = node.SelectSingleNode("LES1Left").InnerText;
            TextBox21.Text        = node.SelectSingleNode("LES1Right").InnerText;
            TextBox25.Text        = node.SelectSingleNode("LELumberParaspinalsRight").InnerText;
            TextBox24.Text        = node.SelectSingleNode("LELumberParaspinalsLeft").InnerText;

            UESen_Click.Checked = node.SelectSingleNode("UEsen") == null ? chkPinPrick.Checked : Convert.ToBoolean(node.SelectSingleNode("UEsen").InnerText);
            TextBox9.Text       = node.SelectSingleNode("UEC5Left").InnerText;
            txtUEC5Right.Text   = node.SelectSingleNode("UEC5Right").InnerText;

            TextBox11.Text = node.SelectSingleNode("UEC6Left").InnerText;
            TextBox12.Text = node.SelectSingleNode("UEC6Right").InnerText;

            TextBox13.Text = node.SelectSingleNode("UEC7Left").InnerText;
            TextBox14.Text = node.SelectSingleNode("UEC7Right").InnerText;

            TextBox15.Text = node.SelectSingleNode("UEC8Left").InnerText;
            TextBox16.Text = node.SelectSingleNode("UEC8Right").InnerText;

            TextBox18.Text = node.SelectSingleNode("UET1Right").InnerText;
            TextBox17.Text = node.SelectSingleNode("UET1Left").InnerText;
            TextBox20.Text = node.SelectSingleNode("UECervicalParaspinalsRight").InnerText;
            TextBox19.Text = node.SelectSingleNode("UECervicalParaspinalsLeft").InnerText;

            //cboHoffmanexam.SelectedValue = node.SelectSingleNode("HoffmanExam").InnerText;
            //chkStocking.Checked = node.SelectSingleNode("Stocking") == null ? chkStocking.Checked : Convert.ToBoolean(node.SelectSingleNode("Stocking").InnerText);
            //chkGlove.Checked = node.SelectSingleNode("Glove") == null ? chkGlove.Checked : Convert.ToBoolean(node.SelectSingleNode("Glove").InnerText);

            LEmmst.Checked = node.SelectSingleNode("LEmmst") == null ? LEmmst.Checked : Convert.ToBoolean(node.SelectSingleNode("LEmmst").InnerText);
            TextBox23.Text = node.SelectSingleNode("LEHipFlexionRight").InnerText;
            TextBox22.Text = node.SelectSingleNode("LEHipFlexionLeft").InnerText;
            TextBox41.Text = node.SelectSingleNode("LEHipAbductionRight").InnerText;
            TextBox40.Text = node.SelectSingleNode("LEHipAbductionLeft").InnerText;
            TextBox27.Text = node.SelectSingleNode("LEKneeExtensionRight").InnerText;
            TextBox26.Text = node.SelectSingleNode("LEKneeExtensionLeft").InnerText;

            TextBox43.Text = node.SelectSingleNode("LEKneeFlexionRight").InnerText;
            TextBox42.Text = node.SelectSingleNode("LEKneeFlexionLeft").InnerText;
            TextBox29.Text = node.SelectSingleNode("LEAnkleDorsiRight").InnerText;
            TextBox28.Text = node.SelectSingleNode("LEAnkleDorsiLeft").InnerText;

            TextBox45.Text = node.SelectSingleNode("LEAnklePlantarRight").InnerText;
            TextBox44.Text = node.SelectSingleNode("LEAnklePlantarLeft").InnerText;

            TextBox47.Text = node.SelectSingleNode("LEAnkleExtensorRight").InnerText;
            TextBox46.Text = node.SelectSingleNode("LEAnkleExtensorLeft").InnerText;

            UEmmst.Checked = node.SelectSingleNode("UEmmst") == null ? UEmmst.Checked : Convert.ToBoolean(node.SelectSingleNode("UEmmst").InnerText);

            TextBox31.Text = node.SelectSingleNode("UEShoulderAbductionRight").InnerText;
            TextBox30.Text = node.SelectSingleNode("UEShoulderAbductionLeft").InnerText;

            TextBox49.Text = node.SelectSingleNode("UEShoulderFlexionRight").InnerText;
            TextBox48.Text = node.SelectSingleNode("UEShoulderFlexionLeft").InnerText;

            TextBox33.Text = node.SelectSingleNode("UEElbowExtensionRight").InnerText;
            TextBox32.Text = node.SelectSingleNode("UEElbowExtensionLeft").InnerText;

            TextBox51.Text = node.SelectSingleNode("UEElbowFlexionRight").InnerText;
            TextBox50.Text = node.SelectSingleNode("UEElbowFlexionLeft").InnerText;

            TextBox53.Text = node.SelectSingleNode("UEElbowSupinationRight").InnerText;
            TextBox52.Text = node.SelectSingleNode("UEElbowSupinationLeft").InnerText;

            TextBox55.Text = node.SelectSingleNode("UEElbowPronationRight").InnerText;
            TextBox54.Text = node.SelectSingleNode("UEElbowPronationLeft").InnerText;

            TextBox37.Text = node.SelectSingleNode("UEWristFlexionRight").InnerText;
            TextBox36.Text = node.SelectSingleNode("UEWristFlexionLeft").InnerText;
            TextBox57.Text = node.SelectSingleNode("UEWristExtensionRight").InnerText;
            TextBox56.Text = node.SelectSingleNode("UEWristExtensionLeft").InnerText;
            TextBox39.Text = node.SelectSingleNode("UEHandGripStrengthRight").InnerText;
            TextBox38.Text = node.SelectSingleNode("UEHandGripStrengthLeft").InnerText;
            TextBox59.Text = node.SelectSingleNode("UEHandFingerAbductorsRight").InnerText;
            TextBox58.Text = node.SelectSingleNode("UEHandFingerAbductorsLeft").InnerText;
        }
    }
Exemple #21
0
        private DataGridColumn GetDataGridColumn(GridItem gItem)
        {
            Binding bding = new Binding();
            if (!string.IsNullOrEmpty(gItem.PropertyName))
            {
                bding.Mode = BindingMode.TwoWay;
                bding.Path = new PropertyPath(gItem.PropertyName);
                if (gItem.ReferenceDataInfo != null)
                {
                    IValueConverter converter = CommonFunction.GetIValueConverter(gItem.ReferenceDataInfo.Type);
                    bding.Converter = converter;
                }
                else if (gItem.PropertyName.Contains("MONEY"))
                {
                    IValueConverter converter = new CurrencyConverter();
                    bding.Converter = converter;
                }
                else
                {
                    IValueConverter converter = new CommonConvert(gItem);
                    bding.Converter = converter;
                }
                
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("");
            }

            DataGridColumn dgc = null;
            switch (gItem.CType)
            {
                case ControlType.CheckBox :
                    DataGridCheckBoxColumn dgcc = new DataGridCheckBoxColumn();
                    dgcc.IsThreeState = false;
                    dgcc.Binding = bding;
                    dgc = dgcc;
                    break;
                case ControlType.Label :
                    if (gItem.ReferenceDataInfo != null)
                    {
                        DataGridReferenceColumn dgrc = new DataGridReferenceColumn();
                        dgrc.Binding = bding;
                        dgrc.DisplayMemberPath = "Text";
                        
                        dgc = dgrc;

                    }
                    else
                    {
                        DataGridTextColumn dgtc = new MyDataGridTextColumn(gItem);
                        dgtc.Binding = bding;
                        dgc = dgtc;
                    }
                    break;

                case ControlType.Combobox :

                    DataGridComboBoxColumn dgcbc = new DataGridComboBoxColumn();
                    if (gItem.ReferenceDataInfo != null)
                    {
                        IList<ITextValueItem> list = DataCore.GetRefData(gItem.ReferenceDataInfo.Type);
                        dgcbc.ItemsSource = list;
                    }
                    dgcbc.DisplayMemberPath = "Text";
                    dgcbc.Binding = bding;

                    dgc = dgcbc;
                    break;

                case ControlType.TreeViewItem :
                    DataGridIconColumn dgtvic = new DataGridIconColumn();
                    dgtvic.Binding = bding;
                    dgc = dgtvic;
                    break;
                case ControlType.Templete:
                    
                     //"<StackPanel Orientation="Horizontal"><smtx:ImageButton x:Name="myDelete" Click="Delete_Click"/></StackPanel>"
                    var gridXCs = new XElementString("StackPanel",new XAttributeString("Orientation", "Horizontal"));
                  
                    DataGridTemplateColumn dtc = new DataGridTemplateColumn();
                    dtc.CellTemplate = DataTemplateHelper.GetDataTemplate(gridXCs);
                    dgc = dtc;
                    break;
            }

            return dgc;
        }
Exemple #22
0
        public void ShouldConvertForNumberLongWithDot()
        {
            var y = CommonConvert.ConvertStringToPrice("123.456.789");

            Assert.AreEqual(123456789, y);
        }
Exemple #23
0
        //保存数据
        public override string SaveData()
        {
            if (string.IsNullOrEmpty(_stockIn.SIType))
            {
                _stockIn.SIType = "22";//调拨入库单
            }
            if (string.IsNullOrEmpty(_stockIn.FromType))
            {
                _stockIn.FromType = CommonConvert.GetFromTypeCode("源于Excel导入的入库单");
            }

            _stockIn.SIStatus     = 1;    //已保存
            _stockIn.FromBillType = "22"; //21采购入库单、22调拨入库单、23其他入库单
            _stockIn.EditStatus   = 0;    //无人编辑

            StringBuilder sb = new StringBuilder();

            using (var edm = new Gold.DAL.GoldEntities())
            {
                try
                {
                    var tmp = edm.StockIn.SingleOrDefault(o => o.SICode == _stockIn.SICode);
                    if (tmp == null)
                    {
                        edm.StockIn.AddObject(_stockIn);
                    }
                    else
                    {
                        if (tmp.SIStatus == 2)
                        {
                            throw new Exception("此入库单(" + tmp.SICode + ")已提交,不允许再次上传!");
                        }
                        else if (tmp.SIStatus == 5)
                        {
                            throw new Exception("此入库单(" + tmp.SICode + ")正在撤销中,不允许再次上传!");
                        }
                        else if (tmp.SIStatus == 3)
                        {
                            throw new Exception("此入库单(" + tmp.SICode + ")入库已完成,不允许再次上传!");
                        }
                        else if (tmp.SIStatus == 4)//已撤销,则默认是全部撤销,用户可重新上传而不是覆盖
                        {
                            //_stockIn.SICode = KeyGenerator.Instance.GetStockInKey();
                            //foreach (StockDetail sd in _stockIn.StockDetail)
                            //{
                            //    sd.BillCode = _stockIn.SICode;
                            //    sd.SOCode = _stockIn.SICode;
                            //}
                            //edm.StockIn.AddObject(_stockIn);
                            throw new Exception("此入库单(" + tmp.SICode + ")已完成撤销,不允许再次上传!");
                        }
                        else
                        {
                            List <StockDetail> lstDetail = new List <StockDetail>();
                            foreach (StockDetail oldDetail in tmp.StockDetail)
                            {
                                lstDetail.Add(oldDetail);

                                //如果实收数量为0,则直接删除
                                if (oldDetail.NumActual == 0)
                                {
                                    continue;
                                }
                                else
                                {
                                    bool isExist = false;//是否新旧订单都有此商品
                                    foreach (StockDetail newDetail in _stockIn.StockDetail)
                                    {
                                        //判断在当前的新excel中是否有此商品,如果有,则保存实收数量
                                        if (newDetail.CargoCode == oldDetail.CargoCode)
                                        {
                                            newDetail.NumActual = oldDetail.NumActual;
                                            isExist             = true;
                                            break;
                                        }
                                    }
                                    if (isExist)
                                    {
                                        continue;
                                    }
                                    else
                                    {
                                        //如果当前新excel没有此商品,则直接添加
                                        StockDetail sd = new StockDetail();
                                        sd.BillCode          = oldDetail.BillCode;
                                        sd.BillRowNumber     = oldDetail.BillRowNumber;
                                        sd.BillType          = oldDetail.BillType;
                                        sd.BinCode           = oldDetail.BinCode;
                                        sd.BinName           = oldDetail.BinName;
                                        sd.CargoCode         = oldDetail.CargoCode;
                                        sd.CargoModel        = oldDetail.CargoModel;
                                        sd.CargoName         = oldDetail.CargoName;
                                        sd.CargoSpec         = oldDetail.CargoSpec;
                                        sd.CargoStatus       = oldDetail.CargoStatus;
                                        sd.CargoUnits        = oldDetail.CargoUnits;
                                        sd.Comment           = oldDetail.Comment;
                                        sd.HandSetFinishTime = oldDetail.HandSetFinishTime;
                                        sd.HandSetPersonID   = oldDetail.HandSetPersonID;
                                        sd.HandSetPersonName = oldDetail.HandSetPersonName;
                                        sd.InOutWHCode       = oldDetail.InOutWHCode;
                                        sd.InOutWHName       = oldDetail.InOutWHName;
                                        sd.NumActual         = oldDetail.NumActual;
                                        sd.NumCurrentPlan    = oldDetail.NumCurrentPlan;
                                        sd.NumOriginalPlan   = oldDetail.NumOriginalPlan;
                                        sd.ReleaseYear       = oldDetail.ReleaseYear;
                                        sd.Reserve1          = oldDetail.Reserve1;
                                        sd.Reserve2          = oldDetail.Reserve2;
                                        sd.RFIDOrderNo       = oldDetail.RFIDOrderNo;
                                        sd.RFIDSubmitTime    = oldDetail.RFIDSubmitTime;
                                        sd.RowTotalMoney     = oldDetail.RowTotalMoney;
                                        sd.SICode            = oldDetail.SICode;
                                        sd.UCOrderNo         = oldDetail.UCOrderNo;

                                        _stockIn.StockDetail.Add(sd);
                                    }
                                }
                            }

                            //由于遍历原数据行项目,导致后续删除无法级联删除。故先删除行项目。
                            foreach (StockDetail detail in lstDetail)
                            {
                                edm.StockDetail.DeleteObject(detail);
                                edm.SaveChanges();
                            }

                            edm.StockIn.DeleteObject(tmp);
                            edm.SaveChanges();
                            edm.StockIn.AddObject(_stockIn);
                        }
                    }

                    edm.SaveChanges();
                    sb.AppendLine("保存成功!");
                }
                catch (Exception ex)
                {
                    sb.Append("保存数据时发生异常:");
                    string msg = Utility.LogHelper.GetExceptionMsg(ex);
                    sb.Append(msg);

                    Utility.LogHelper.WriteLog(Utility.LogHelper.LogLevel.Error, "调拨入库单保存异常", ex);
                }
            }

            return(sb.ToString());
        }
Exemple #24
0
        public void ShouldConvertForNumberLongWitComma()
        {
            var y = CommonConvert.ConvertStringToPrice("123,455,789");

            Assert.AreEqual(123455789, y);
        }
Exemple #25
0
        public void CheckPriceParseOfERotenCom()
        {
            var x = CommonConvert.ConvertStringToPrice("657.00");

            Assert.AreEqual(657, x);
        }
Exemple #26
0
        protected override void BindingOrderItem(object[] array)
        {
            if (_order.StockDetail == null)
            {
                _order.StockDetail = new EntityCollection <StockDetail>();
            }

            if (_itemDefine == null)
            {
                throw new ApplicationException("未发现行项目字段定义!");
            }

            if (_itemDefine.Count() == array.Count())
            {
                StockDetail orderItem = new StockDetail();
                for (int i = 0; i < array.Count(); i++)
                {
                    string fieldName  = Regex.Replace(_itemDefine[i].ToString(), @"\s", "");
                    string fieldValue = Regex.Replace(array[i].ToString(), @"\s", "");

                    switch (fieldName)
                    {
                    case "存货编码":
                        orderItem.CargoCode = fieldValue;
                        string cargoCode = DbCommonMethod.ParsingCargoCode(fieldValue);
                        if (string.IsNullOrEmpty(cargoCode))
                        {
                            throw new ApplicationException("商品不存在:" + fieldValue);
                        }
                        break;

                    case "商品名称":
                        orderItem.CargoName = fieldValue;
                        break;

                    case "规格":
                        orderItem.CargoSpec = fieldValue;
                        break;

                    case "型号":
                        //过滤型号值,如果型号是90.000,则去90,去掉小数点后面的0
                        double dou;
                        string strModel = fieldValue;
                        double douModel = 0;
                        if (double.TryParse(fieldValue, out dou))
                        {
                            douModel = dou;
                        }

                        if (douModel != 0 && strModel.Contains("."))
                        {
                            string sdecimal = strModel.Substring(strModel.IndexOf(".") + 1, strModel.Length - strModel.IndexOf(".") - 1);
                            int    istring  = Convert.ToInt32(sdecimal);
                            if (istring == 0)
                            {
                                strModel = fieldValue.Substring(0, fieldValue.IndexOf("."));
                            }
                        }
                        orderItem.CargoModel = strModel;
                        break;

                    case "单位":
                        orderItem.CargoUnits = fieldValue;
                        break;

                    case "数量":
                        if (!string.IsNullOrEmpty(fieldValue))
                        {
                            double d;
                            if (double.TryParse(fieldValue, out d))
                            {
                                orderItem.NumOriginalPlan = d;
                            }
                        }
                        break;

                    //暂留空,因为没看到有字段保存单价信息的(因为系统只管商品,不管金额,所以暂时不用存单价)
                    //case "销售单价":
                    //    if (!string.IsNullOrEmpty(fieldValue))
                    //    {
                    //        decimal d;
                    //        if (decimal.TryParse(fieldValue, out d))
                    //            orderItem.Price = d;
                    //    }
                    //    break;

                    case "销售金额":
                        if (!string.IsNullOrEmpty(fieldValue))
                        {
                            decimal de;
                            if (decimal.TryParse(fieldValue, out de))
                            {
                                orderItem.RowTotalMoney = de;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                if (string.IsNullOrEmpty(orderItem.BillRowNumber))
                {
                    orderItem.BillRowNumber = _rowNum.ToString();
                }

                orderItem.NumCurrentPlan = orderItem.NumOriginalPlan; //订单数量=应收数量,默认值
                orderItem.CargoStatus    = 0;                         //手持机未完成
                orderItem.BillCode       = _order.SOCode;
                orderItem.SOCode         = _order.SOCode;
                orderItem.BillType       = CommonConvert.GetBillTypeCode("出库单");
                orderItem.InOutWHCode    = _order.WHCode;
                orderItem.StockOut       = _order;
                IEnumerable <KeyValuePair <string, object> > entityKeyValues =
                    new KeyValuePair <string, object>[] {
                    new KeyValuePair <string, object>("BillCode", orderItem.BillCode),
                    new KeyValuePair <string, object>("BillRowNumber", orderItem.BillRowNumber)
                };
                orderItem.EntityKey = new EntityKey("GoldEntities.StockDetail", entityKeyValues);
                _order.StockDetail.Add(orderItem);
            }
        }
Exemple #27
0
        /// <summary>
        /// 从DataTable中获取采购订单明细实体列表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private List <DAL.StockDetail> GetModelDetailFromDataTable(DataTable dt, out string msg, string SICode, string WHCode)
        {
            try
            {
                List <DAL.StockDetail> list = new List <DAL.StockDetail>();
                msg = "";

                //接口协议文档中定义的字段
                Dictionary <string, string> dataFieldNameDic = new Dictionary <string, string>();
                dataFieldNameDic.Add("BillCode", "其他入库单号");
                dataFieldNameDic.Add("DetailRowNumber", "行号");
                dataFieldNameDic.Add("CargoCode", "商品编码");
                dataFieldNameDic.Add("CargoName", "商品名称");
                dataFieldNameDic.Add("CargoSpec", "规格");
                dataFieldNameDic.Add("CargoModel", "型号");
                dataFieldNameDic.Add("CargoUnits", "单位");
                dataFieldNameDic.Add("NumOriginalPlan", "数量");
                dataFieldNameDic.Add("Remark", "备注");

                if (dt == null || dt.Rows.Count == 0)
                {
                    msg = "用友系统返回数据集中无数据!";
                    return(new List <StockDetail>());
                }

                StringBuilder errorColName = new StringBuilder();
                //检查数据集中是否存在指定字段
                foreach (KeyValuePair <string, string> kvp in dataFieldNameDic)
                {
                    if (dt.Columns.Contains(kvp.Key) == false)
                    {
                        errorColName.Append(Environment.NewLine);
                        errorColName.Append(kvp.Value);
                        errorColName.Append("-");
                        errorColName.Append(kvp.Key);
                    }
                }
                if (errorColName.Length > 0)
                {
                    errorColName.Insert(0, "用友系统返回的数据集中未包含如下字段,不能进行有效解析!");
                    msg = errorColName.ToString();
                    return(new List <StockDetail>());;
                }

                //遍历数据集创建实体
                foreach (DataRow dr in dt.Rows)
                {
                    StockDetail newModel = new StockDetail();

                    //newModel.BillCode= DataCheckHelper.GetCellString(dr["BillCode"]);
                    newModel.BillRowNumber = DataCheckHelper.GetCellString(dr["DetailRowNumber"]);
                    //商品编码
                    newModel.CargoCode = DataCheckHelper.GetCellString(dr["CargoCode"]);
                    string cargoCode = DbCommonMethod.ParsingCargoCode(newModel.CargoCode);
                    if (string.IsNullOrEmpty(cargoCode))
                    {
                        throw new ApplicationException("单号" + DataCheckHelper.GetCellString(dr["BillCode"]) + ",商品不存在:" + newModel.CargoCode);
                    }

                    newModel.CargoName  = DataCheckHelper.GetCellString(dr["CargoName"]);
                    newModel.CargoSpec  = DataCheckHelper.GetCellString(dr["CargoSpec"]);
                    newModel.CargoModel = DataCheckHelper.GetCellString(dr["CargoModel"]);
                    newModel.CargoUnits = DataCheckHelper.GetCellString(dr["CargoUnits"]);

                    //数量
                    if (!string.IsNullOrEmpty(DataCheckHelper.GetCellString(dr["NumOriginalPlan"])))
                    {
                        double d;
                        if (double.TryParse(DataCheckHelper.GetCellString(dr["NumOriginalPlan"]), out d))
                        {
                            newModel.NumOriginalPlan = d;
                        }
                    }

                    newModel.Comment = DataCheckHelper.GetCellString(dr["Remark"]);

                    newModel.NumCurrentPlan = newModel.NumOriginalPlan; //订单数量=应收数量,默认值
                    newModel.CargoStatus    = 0;                        //手持机未完成
                    newModel.SICode         = SICode;
                    newModel.BillCode       = newModel.SICode;
                    newModel.BillType       = CommonConvert.GetBillTypeCode("入库单");
                    newModel.InOutWHCode    = WHCode;

                    string             bill             = DataCheckHelper.GetCellString(dr["BillCode"]);
                    List <StockDetail> existStockDetail = (from r in list where r.BillCode == bill && r.BillRowNumber == newModel.BillRowNumber select r).ToList <StockDetail>();
                    if (existStockDetail == null || existStockDetail.Count == 0)//过滤重复数据
                    {
                        list.Add(newModel);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(new List <StockDetail>());;
            }
        }
Exemple #28
0
        /// <summary>
        /// 从DataTable中获取实体列表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private List <DAL.StockIn> GetModelFromDataTable(DataTable dt, out string msg)
        {
            try
            {
                List <DAL.StockIn> list = new List <DAL.StockIn>();
                msg = "";

                //接口协议文档中定义的字段
                Dictionary <string, string> dataFieldNameDic = new Dictionary <string, string>();
                dataFieldNameDic.Add("BillCode", "其他入库单号");
                dataFieldNameDic.Add("BillDate", "日期");
                dataFieldNameDic.Add("InCategory", "收发类别");
                dataFieldNameDic.Add("Supplier", "供货单位");
                dataFieldNameDic.Add("BusinessDepartmentName", "业务部门");
                dataFieldNameDic.Add("Operator", "业务员姓名");
                dataFieldNameDic.Add("WHName", "仓库名称");
                dataFieldNameDic.Add("StoreKeeper", "库管员");
                dataFieldNameDic.Add("Comment", "备注");
                dataFieldNameDic.Add("TotalNumber", "合计数量");
                dataFieldNameDic.Add("WareHouseKeeper", "仓管");
                dataFieldNameDic.Add("Checker", "验收");

                if (dt == null || dt.Rows.Count == 0)
                {
                    msg = "用友系统返回数据集中无数据!";
                    return(new List <StockIn>());
                }

                StringBuilder errorColName = new StringBuilder();
                //检查数据集中是否存在指定字段
                foreach (KeyValuePair <string, string> kvp in dataFieldNameDic)
                {
                    if (dt.Columns.Contains(kvp.Key) == false)
                    {
                        errorColName.Append(Environment.NewLine);
                        errorColName.Append(kvp.Value);
                        errorColName.Append("-");
                        errorColName.Append(kvp.Key);
                    }
                }
                if (errorColName.Length > 0)
                {
                    errorColName.Insert(0, "用友系统返回的数据集中未包含如下字段,不能进行有效解析!");
                    msg = errorColName.ToString();
                    return(new List <StockIn>());;
                }

                //遍历数据集创建实体
                foreach (DataRow dr in dt.Rows)
                {
                    StockIn newModel = new StockIn();
                    //newModel.SICode = KeyGenerator.Instance.GetStockInKey();
                    newModel.FromBillNo = DataCheckHelper.GetCellString(dr["BillCode"]);

                    //日期
                    if (!string.IsNullOrEmpty(DataCheckHelper.GetCellString(dr["BillDate"])))
                    {
                        DateTime d;
                        if (DateTime.TryParse(DataCheckHelper.GetCellString(dr["BillDate"]), out d))
                        {
                            newModel.SIDate = d;
                        }
                    }

                    //收发类别
                    newModel.InCategory = DbCommonMethod.GetInCategory(DataCheckHelper.GetCellString(dr["InCategory"]));

                    newModel.Supplier = DataCheckHelper.GetCellString(dr["Supplier"]);
                    newModel.BusinessDepartmentName = DataCheckHelper.GetCellString(dr["BusinessDepartmentName"]);
                    newModel.Operator = DataCheckHelper.GetCellString(dr["Operator"]);

                    //仓库
                    newModel.WHName = DataCheckHelper.GetCellString(dr["WHName"]);
                    newModel.WHCode = DbCommonMethod.ParsingWarehouse(newModel.WHName);
                    if (string.IsNullOrEmpty(newModel.WHCode))
                    {
                        throw new ApplicationException("单号" + newModel.FromBillNo + ",仓库不存在:" + newModel.WHName);
                    }

                    newModel.StoreKeeper = DataCheckHelper.GetCellString(dr["StoreKeeper"]);
                    newModel.Comment     = DataCheckHelper.GetCellString(dr["Comment"]);

                    //合计数量
                    if (!string.IsNullOrEmpty(DataCheckHelper.GetCellString(dr["TotalNumber"])))
                    {
                        double d;
                        if (double.TryParse(DataCheckHelper.GetCellString(dr["TotalNumber"]), out d))
                        {
                            newModel.TotalNumber = d;
                        }
                    }

                    //newModel = DataCheckHelper.GetCellString(dr["WareHouseKeeper"]);
                    newModel.Checker = DataCheckHelper.GetCellString(dr["Checker"]);

                    newModel.SIStatus     = 1;    //已保存
                    newModel.FromBillType = "23"; //21采购入库单、22调拨入库单、23其他入库单
                    newModel.SIType       = CommonConvert.GetSIOTypeCode("其他入库单");
                    newModel.FromType     = CommonConvert.GetFromTypeCode("源于Excel导入的入库单");

                    List <StockIn> existStockIn = (from r in list where r.FromBillNo == newModel.FromBillNo select r).ToList <StockIn>();
                    if (existStockIn == null || existStockIn.Count == 0)//过滤重复数据
                    {
                        list.Add(newModel);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(new List <StockIn>());;
            }
        }
Exemple #29
0
        /// <summary>
        /// 从DataTable中获取实体列表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private List <DAL.StockOut> GetModelFromDataTable(DataTable dt, out string msg)
        {
            try
            {
                List <DAL.StockOut> list = new List <DAL.StockOut>();
                msg = "";

                //接口协议文档中定义的字段
                Dictionary <string, string> dataFieldNameDic = new Dictionary <string, string>();
                dataFieldNameDic.Add("BillCode", "其他出库单号");
                dataFieldNameDic.Add("BillDate", "日期");
                dataFieldNameDic.Add("OutCategory", "收发类别");
                dataFieldNameDic.Add("OutWHName", "发出仓库");
                dataFieldNameDic.Add("Comment", "备注");
                dataFieldNameDic.Add("TotalNumber", "合计数量");
                dataFieldNameDic.Add("LeaderSign", "领导");
                dataFieldNameDic.Add("WareHouseKeeper", "仓管");
                dataFieldNameDic.Add("AccountSign", "财务");
                dataFieldNameDic.Add("BusinessSign", "经办人");
                dataFieldNameDic.Add("EditorSign", "制单人");

                if (dt == null || dt.Rows.Count == 0)
                {
                    msg = "用友系统返回数据集中无数据!";
                    return(new List <StockOut>());
                }

                StringBuilder errorColName = new StringBuilder();
                //检查数据集中是否存在指定字段
                foreach (KeyValuePair <string, string> kvp in dataFieldNameDic)
                {
                    if (dt.Columns.Contains(kvp.Key) == false)
                    {
                        errorColName.Append(Environment.NewLine);
                        errorColName.Append(kvp.Value);
                        errorColName.Append("-");
                        errorColName.Append(kvp.Key);
                    }
                }
                if (errorColName.Length > 0)
                {
                    errorColName.Insert(0, "用友系统返回的数据集中未包含如下字段,不能进行有效解析!");
                    msg = errorColName.ToString();
                    return(new List <StockOut>());;
                }

                //遍历数据集创建实体
                foreach (DataRow dr in dt.Rows)
                {
                    StockOut newModel = new StockOut();
                    //newModel.SOCode = KeyGenerator.Instance.GetStockOutKey();
                    newModel.FromBillNo = DataCheckHelper.GetCellString(dr["BillCode"]);

                    //日期
                    if (!string.IsNullOrEmpty(DataCheckHelper.GetCellString(dr["BillDate"])))
                    {
                        DateTime d;
                        if (DateTime.TryParse(DataCheckHelper.GetCellString(dr["BillDate"]), out d))
                        {
                            newModel.SODate = d;
                        }
                    }

                    //收发类别
                    newModel.OutCategory = DbCommonMethod.GetOutCategory(DataCheckHelper.GetCellString(dr["OutCategory"]));

                    newModel.WHName = DataCheckHelper.GetCellString(dr["OutWHName"]);
                    newModel.WHCode = DbCommonMethod.ParsingWarehouse(newModel.WHName);
                    if (string.IsNullOrEmpty(newModel.WHCode))
                    {
                        throw new ApplicationException("单号" + newModel.FromBillNo + ",仓库不存在:" + newModel.WHName);
                    }

                    newModel.Comment = DataCheckHelper.GetCellString(dr["Comment"]);

                    //合计数量
                    if (!string.IsNullOrEmpty(DataCheckHelper.GetCellString(dr["TotalNumber"])))
                    {
                        decimal d;
                        if (decimal.TryParse(DataCheckHelper.GetCellString(dr["TotalNumber"]), out d))
                        {
                            newModel.TotalMoney = d;
                        }
                    }

                    newModel.LeaderSign    = DataCheckHelper.GetCellString(dr["LeaderSign"]);
                    newModel.WarehouseSign = DataCheckHelper.GetCellString(dr["WareHouseKeeper"]);
                    newModel.AccountSign   = DataCheckHelper.GetCellString(dr["AccountSign"]);
                    newModel.BusinessSign  = DataCheckHelper.GetCellString(dr["BusinessSign"]);
                    newModel.EditorSign    = DataCheckHelper.GetCellString(dr["EditorSign"]);

                    newModel.SOStatus     = 1;    //已保存
                    newModel.FromBillType = "13"; //11-销售出库单、12-调拨出库单、13-其他出库单
                    newModel.EditStatus   = 0;    //无人编辑
                    newModel.SOType       = CommonConvert.GetSIOTypeCode("其他出库单");
                    newModel.FromType     = CommonConvert.GetFromTypeCode("源于Excel导入的出库单");

                    List <StockOut> existStockOut = (from r in list where r.FromBillNo == newModel.FromBillNo select r).ToList <StockOut>();
                    if (existStockOut == null || existStockOut.Count == 0)//过滤重复数据
                    {
                        list.Add(newModel);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(new List <StockOut>());;
            }
        }
    protected void btnupload_mul_Click(object sender, EventArgs e)
    {
        DBHelperClass dBHelperClass = new DBHelperClass();
        DataSet       dataSet = new DataSet();
        string        fname = "", lname = "", doa = "";


        foreach (HttpPostedFile postedFile in fupmul.PostedFiles)
        {
            //string[] fileName = Path.GetFileName(postedFile.FileName).Split(',');
            string fileName = Path.GetFileName(postedFile.FileName);
            string msg      = "";
            try
            {
                Regex re = new Regex(@"\d+");
                Match m  = re.Match(fileName);
                if (m.Success)
                {
                    string   file = fileName.Substring(0, m.Index);
                    string[] str  = file.Split(',');
                    // lblResults.Text = string.Format("RegEx found " + m.Value + " at position " + m.Index.ToString() + " character in string is " + file + " fname: " + str[1] + ",LastName:" + str[0]);
                    lname = str[0];

                    if (str[1].Contains("_"))
                    {
                        fname = str[1].Split('_')[0];
                    }
                    else
                    {
                        fname = str[1];
                    }

                    file = fileName;
                    str  = file.Split('_');
                    if (str.Length > 2)
                    {
                        doa = str[str.Length - 1].ToLower().Split('.')[0];
                    }
                }
                else
                {
                    string[] str = fileName.Split('_');
                    fname = str[0].Split(',')[1];
                    lname = str[0].Split(',')[0];
                }

                doa = CommonConvert.DateformatDOA(doa);
                doa = CommonConvert.DateFormat(doa);

                string[] strfname = fname.TrimStart().Split(' ');
                fname   = strfname[0];
                dataSet = dBHelperClass.selectData("select Patient_ID from tblPatientMaster where LastName='" + lname.Trim().TrimStart() + "' and FirstName='" + fname.Trim().TrimStart() + "'");

                if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
                {
                    string patientid = dataSet.Tables[0].Rows[0][0].ToString();

                    string upload_folder_path = "~/PatientDocument/" + patientid;

                    if (!Directory.Exists(upload_folder_path))
                    {
                        Directory.CreateDirectory(Server.MapPath(upload_folder_path));
                    }

                    postedFile.SaveAs(System.IO.Path.Combine(Server.MapPath(upload_folder_path), fileName));

                    sb.Append("<p>File Name : " + fileName + "  patientid:" + patientid + "     Status : Uploaded </p>");
                    sb.Append(Environment.NewLine);
                    Logger.Info("File Name : " + fileName + "  patientid:" + patientid + "     Status : Uploaded");

                    //string filename = System.DateTime.Now.Millisecond.ToString() + "_" + fileName;
                    if (checkName(fileName, patientid) == false)
                    {
                        string filename = fileName;
                        string query    = "insert into tblPatientDocument values('" + filename + "','" + System.DateTime.Now.ToString() + "','" + upload_folder_path + "/" + filename + "'," + patientid + ",'" + doa + "')";

                        dBHelperClass.executeQuery(query);
                    }
                }
                else
                {
                    sb.Append("<p style='color:red'> File Name : " + fileName + "     Status : Not Uploaded</p>");
                    sb.Append(Environment.NewLine);
                    Logger.Info("File Name : " + fileName + "     Status : Not Uploaded");
                }
            }
            catch (Exception ex)
            {
                sb.Append("<p style='color:red'>File Name : " + fileName + "     Status : Not Uploaded </p>");
                Logger.Error("File Name : " + fileName + "       Status : Not Uploaded \n");
            }
            lblResult.InnerHtml = sb.ToString();
        }
    }
Exemple #31
0
        public void ShouldConvertForGreaterOneComanAndLessThreadNumbeEnd()
        {
            var y = CommonConvert.ConvertStringToPrice("123,789,91");

            Assert.AreEqual(123789.91, y);
        }