示例#1
0
        internal CommandUploadMappingEntity GetCommandMappingById(int Id)
        {
            CommandUploadMappingEntity results = new CommandUploadMappingEntity();

            try
            {
                StoredProcedureEntity sproc = new StoredProcedureEntity();
                sproc.StoredProcedureName = "dnb.GetCommandMappingById";
                sproc.StoredProceduresParameter.Add(GetParam("@Id", Id.ToString(), SQLServerDatatype.IntDataType));
                DataTable dt;
                dt = sql.ExecuteDataTable(CommandType.StoredProcedure, sproc, "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    CommandUploadMappingAdapter ta = new CommandUploadMappingAdapter();
                    foreach (DataRow rw in dt.Rows)
                    {
                        results = ta.AdaptItem(rw, dt);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(results);
        }
示例#2
0
        internal string InsertUpdateCommandUploadMapping(CommandUploadMappingEntity objCommandMapping)
        {
            try
            {
                StoredProcedureEntity sproc = new StoredProcedureEntity();

                sproc.StoredProcedureName = "dnb.InsertUpdateCommandUploadMapping";
                sproc.StoredProceduresParameter.Add(GetParam("@Id", objCommandMapping.Id.ToString(), SQLServerDatatype.IntDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@ConfigurationName", objCommandMapping.ConfigurationName.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@ImportType", objCommandMapping.ImportType.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@FileFormat", objCommandMapping.FileFormat.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@FormatValue", objCommandMapping.Formatvalue == null ? null : objCommandMapping.Formatvalue.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@ColumnMapping", objCommandMapping.ColumnMapping.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@IsDefault", objCommandMapping.IsDefault.ToString(), SQLServerDatatype.BitDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@UserId", objCommandMapping.UserId.ToString(), SQLServerDatatype.IntDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@Tags", objCommandMapping.Tags == null ? null : objCommandMapping.Tags.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@InLanguage", objCommandMapping.InLanguage == null ? null : objCommandMapping.InLanguage.ToString(), SQLServerDatatype.VarcharDataType));
                sproc.StoredProceduresParameter.Add(GetParam("@OriginalColumns", objCommandMapping.OriginalColumns == null ? null : objCommandMapping.OriginalColumns.ToString(), SQLServerDatatype.VarcharDataType));
                sql.ExecuteNoReturn(CommandType.StoredProcedure, sproc);
                return("");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
示例#3
0
        //GET : Insert Update Command Upload Mapping
        public ActionResult CreateCommandMapping(string Parameters)
        {
            CommandUploadMappingEntity objCommandUploadMappingEntity = new CommandUploadMappingEntity();

            string ImportType = "data import";

            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                int id = Convert.ToInt32(Parameters);
                if (id > 0)
                {
                    bool IsTag              = false;
                    bool IsInLanguage       = false;
                    ColumnMappingFacade tac = new ColumnMappingFacade(this.CurrentClient.ApplicationDBConnectionString);
                    objCommandUploadMappingEntity = tac.GetCommandMappingById(id);
                    // Check if file contains tag field or not
                    if (Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "tags") || Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "tag"))
                    {
                        IsTag = true;
                    }
                    // Check if file contains language field or not
                    if (Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "language") ||
                        Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "language values") ||
                        Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "languagevalues") ||
                        Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "language code") ||
                        Array.Exists(objCommandUploadMappingEntity.OriginalColumns.Split(','), element => element.ToLower() == "languagecode"))
                    {
                        IsInLanguage = true;
                    }

                    List <SelectListItem> lstAllFilter          = new List <SelectListItem>();
                    List <string>         LstOriginalcolumnName = new List <string>();
                    LstOriginalcolumnName.AddRange(objCommandUploadMappingEntity.OriginalColumns.Split(','));
                    int i = 0;
                    foreach (var item in LstOriginalcolumnName)
                    {
                        lstAllFilter.Add(new SelectListItem {
                            Value = (i).ToString(), Text = Convert.ToString(item)
                        });
                        i++;
                    }
                    ViewBag.IsContainsTags = IsTag;
                    SessionHelper.CommandMapping_IsInLanguage = IsInLanguage;
                    ViewBag.ExternalColumn = lstAllFilter;
                    ViewBag.ColumnMapping  = objCommandUploadMappingEntity.ColumnMapping;
                    ImportType             = objCommandUploadMappingEntity.ImportType;
                    objCommandUploadMappingEntity.FileFormatCommandLine = objCommandUploadMappingEntity.FileFormat;
                }
            }
            //get column Name
            List <string> columnName = GetcolumnName(ImportType, this.CurrentClient.ApplicationDBConnectionString);

            ViewBag.ImportMode = ImportType;
            ViewBag.ColumnList = columnName;

            return(PartialView("_createCommandMapping", objCommandUploadMappingEntity));
        }
示例#4
0
        public ActionResult InsertUpdate(CommandUploadMappingEntity obj)
        {
            if (ModelState.IsValid)
            {
                ColumnMappingFacade fac = new ColumnMappingFacade(this.CurrentClient.ApplicationDBConnectionString);
                obj.UserId      = Helper.oUser.UserId;
                obj.Tags        = string.IsNullOrEmpty(obj.Tags) ? "" : obj.Tags == "0" ? "" : obj.Tags;
                obj.Formatvalue = obj.FileFormat == "Delimiter" ? obj.Formatvalue : "";
                obj.FileFormat  = obj.FileFormatCommandLine;
                string msg        = fac.InsertUpdateCommandUploadMapping(obj);
                string ImportType = obj == null ? "data import" : string.IsNullOrEmpty(obj.ImportType) ? "data import" : obj.ImportType.ToLower();
                if (string.IsNullOrEmpty(msg))
                {
                    if (obj.Id > 0)
                    {
                        ViewBag.Message = CommonMessagesLang.msgCommanUpdateMessage;
                        ImportType      = obj.ImportType;



                        List <SelectListItem> lstAllFilter          = new List <SelectListItem>();
                        List <string>         LstOriginalcolumnName = new List <string>();
                        LstOriginalcolumnName.AddRange(obj.OriginalColumns.Split(','));
                        int i = 0;
                        foreach (var item in LstOriginalcolumnName)
                        {
                            lstAllFilter.Add(new SelectListItem {
                                Value = (i).ToString(), Text = Convert.ToString(item)
                            });
                            i++;
                        }
                        ViewBag.ExternalColumn = lstAllFilter;
                        ViewBag.ColumnMapping  = obj.ColumnMapping;
                    }
                    else
                    {
                        ViewBag.Message = CommonMessagesLang.msgCommanInsertMessage;
                        obj             = new CommandUploadMappingEntity();
                    }
                }
                else
                {
                    ViewBag.Message = msg;
                }

                List <string> columnName = GetcolumnName(ImportType, this.CurrentClient.ApplicationDBConnectionString);
                ViewBag.ColumnList = columnName;
                ViewBag.ImportMode = ImportType;
            }
            else
            {
                ViewBag.Message = DandBSettingLang.msgInvadilState;
            }
            return(PartialView("_createCommandMapping", obj));
        }
示例#5
0
 public string InsertUpdateCommandUploadMapping(CommandUploadMappingEntity objCommandMapping)
 {
     return rep.InsertUpdateCommandUploadMapping(objCommandMapping);
 }